简体   繁体   English

Outlook 加载项无法获取附件

[英]Outlook addin unable to fetch attachments

I am working on an outlook addin which needs to get the attachments for the mail.我正在开发一个 outlook 插件,它需要获取邮件的附件。 I am using office.js and the following code to fetch the mail item.我正在使用 office.js 和以下代码来获取邮件项目。

        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.对于 outlook 封邮件,一切都按预期工作。 I am able to access the properties such as subject, cc, bcc etc for outlook mails.我能够访问 outlook 封邮件的主题、抄送、密件抄送等属性。 But when I configured gmail inside outlook in mac, it fails to fetch the gmail attachments.但是当我在 mac 中配置 gmail inside outlook 时,它无法获取 gmail 附件。 Rest of the details ( subject, cc etc ) are available for use. Rest 的详细信息(主题、抄送等)可供使用。

Is there any limitation on attachments in gmail? gmail对附件有限制吗? or am I missing some additional steps to access gmail attachments configured inside outlook mail in mac?或者我是否缺少一些额外的步骤来访问 gmail 在 mac 中配置的 outlook 邮件中的附件?

Outlook web add-ins works for the Exchange accounts only. Outlook web 加载项仅适用于 Exchange 帐户。 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.通常,一组AttachmentDetails对象作为约会或消息项的附件属性返回。

// 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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM