I'm using ews-js-api-browser to develop an outlook desktop add-in.
EwsJS namespace is currently imported with a <script> tag, like office-js library.
Office.initialize = function (reason) {
EwsJS.ConfigureForOutlook()
EwsJS.EwsLogging.DebugLogEnabled = false
}
const functionWhichNeedAttachment = () => {
Office.context.mailbox.getCallbackTokenAsync((token) => {
const exch = new EwsJS.ExchangeService(EwsJS.ExchangeVersion.Exchange2016)
exch.Credentials = new EwsJS.OAuthCredentials(token.value)
exch.Url = new EwsJS.Uri(Office.context.mailbox.ewsUrl)
exch.GetAttachments(
[Office.context.mailbox.item.attachments[0].id],
1,
null).then(res => console.log('res', res))
})
})
}
I get this error :
Object doesn't support this action ExchangeWebService.js (41867, 9)
It seems like ExchangeWebService is trying to assign a value to a forbidden keyword.
Please take a look at https://learn.microsoft.com/en-us/outlook/add-ins/web-services
there is only subset of EWS operations available using
mailbox.makeEwsRequestAsyncwhich is internally used by ews-javascript-api for Outlook/Mail app.unfortunately
GetAttachmentsis not available in mail apps.