Outlook addin unable to fetch attachments

I am working on an outlook addin which needs to get the attachments for the mail. I am using office.js and the following code to fetch the mail item.

        Office.onReady( () => {        
        currentMailItem = Office.context.mailbox.item;
        const subject = currentMailItem.subject; // works fine;
        const attachments = currentMailItem.attachments; 
        //returns empty array for gmail configured in outlook
        //----- more code  -------
        }

Everything works as expected for outlook mails. I am able to access the properties such as subject, cc , bcc etc for outlook mails. But when I configured gmail inside outlook in mac , it fails to fetch the gmail attachments. Rest of the details ( subject, cc etc ) are available for use.

Is there any limitation on attachments in gmail ? or am I missing some additional steps to access gmail attachments configured inside outlook mail in mac?

Answer

Outlook web add-ins works for the Exchange accounts only. Non-exchange backed accounts are not supported.


Typically an array of AttachmentDetails objects is returned as the attachments property of an appointment or message item.

// The following code builds an HTML string with details
// of all attachments on the current item.
var item = Office.context.mailbox.item;
var outputString = "";

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

console.log(outputString);