Search code examples
outlookoutlook-web-addins

Outlook Add-in file reading from mail


I am working on a Outlook add-in. I am not able to use the method item.getAttachmentsAsync in my plugin code to load and read the content of files. I am getting ERROR TypeError: item.getAttachmentsAsync is not a function in run time.

var item = Office.context.mailbox.item;
var options = {asyncContext: {currentItem: item}};
item.getAttachmentsAsync(options, this.callback);

My requirement is explained below,

In the plugin we have a form and few fields are populated from mail body. And I need mail attachments to auto upload to Form.

Please suggest a better way to do that.


Solution

  • using getAttachmentContentAsync I am able to get the file as a blob. but the problem is we need to call this method as soon after the mail opening. otherwise getting cors error