I try to retrieve attachments from a mail in an OWA (Outlook Web App). I use the tool "Napa" who allows me to create only .js, .css and . html files. So i need to use .js to retrieve the attachments. According to the Microsoft's documentation i wrote this code :
/// <reference path="../App.js" />
// global app
var serviceRequest;
var xhr;
(function () {
'use strict';
// The Office initialize function must be run each time a new page is loaded
Office.initialize = function (reason) {
$(document).ready(function () {
app.initialize();
if (Office.context.mailbox.item.attachments.length !== 0)
{
serviceRequest = new Object();
serviceRequest.attachmentToken = "";
serviceRequest.ewsUrl = Office.context.mailbox.ewsUrl;
serviceRequest.attachmentIDs = new Array();
Office.context.mailbox.getCallbackTokenAsync(getAttachment);
}
});
};
function getAttachment(asyncResult)
{
if(asyncResult.status==="succeeded")
{
serviceRequest.attachmentToken = asyncResult.value;
var item = Office.context.mailbox.item;
for (var i = 0; i < item.attachments.length; i++)
{
serviceRequest.attachmentIDs.push(item.attachments[i].id);
}
makeServiceRequest();
}
}
But when I arrive at the implementation fo the function makeServiceRequest() I don't know what i need to do. Microsoft's documentation](https://dev.office.com/docs/add-ins/outlook/get-attachments-of-an-outlook-item) gives me C# codes but I don't understand. I've only .js files ...