Niko
Niko

Reputation: 832

Cannot get attachments in Outlook Calendar add-in

I am developing Microsoft Outlook Web Add-in, which is displayed in Calendar only. However, I cannot get appointment attachments using api: Office.context.mailbox.item.attachments, and the attachments object is undefined. I would like to point out that in mail reading I can get attachments details without problems. This happens only in calendar. Do you have any suggestions?

Upvotes: 1

Views: 215

Answers (2)

user7823505
user7823505

Reputation:

As mufeez mentioned above, Office.context.mailbox.item.attachments is not supported in edit mode.

Upvotes: 2

Muhammad Mufeez Ahmed
Muhammad Mufeez Ahmed

Reputation: 92

/* Can you please try with below Code Snippet ,it's working in mycase for latest Outlook for Windows 16.0.8625.2121 ,i have ReadWriteMailbox permissions for my add-ins which is not mandatory though ,it should work with ReadItem as well

/* Office.context.mailbox.item.attachments is not supported in edit mode i.e when you are a organizer of Appointment/Meeting */

/* ReadItem or ReadWriteItem or ReadWriteMailbox / / Get list of attachments */

var outputString = "";
for (i = 0; i < Office.context.mailbox.item.attachments.length; i++) {
     var _att = Office.context.mailbox.item.attachmen[i];
     outputString += "<BR>" + i + ". Name: ";
     outputString += _att.name;
     outputString += "<BR>ID: " + _att.id;
     outputString += "<BR>contentType: "+_att.contentType;
     outputString += "<BR>size: " + _att.size;
     outputString += "<BR>attachmentType: " + _att.attachmentType;
     outputString += "<BR>isInline: " + _att.isInline;
}

Upvotes: 0

Related Questions