简体   繁体   English

Outlook外接程序API Office365

[英]Outlook Add-In API Office365

I'm developing an Outlook Add-In for Outlook Online O365 with Javascript code. 我正在使用Javascript代码开发用于Outlook Online O365的Outlook加载项。 Through the API I retrieve the object MailItem ( Office.context.mailbox.item ). 通过API,我检索对象MailItem( Office.context.mailbox.item )。

Is it possible to export the MailItem to file .msg and upload it to SharePoint Document Library? 是否可以将MailItem导出到文件.msg并将其上载到SharePoint文档库?

You can upload Mailitem body as Document in Library. 您可以将Mailitem正文作为文档上载到库中。 To get the mail Item body 获取邮件项目正文

 var item = Office.context.mailbox.item;
    if (item.itemType == Office.MailboxEnums.ItemType.Message) {         
            itemType = item.itemType;
            itemID = item.itemId;
            subject = item.subject;
            body = getBody(item);           
    }
 function getBody(item) {
    Office.context.mailbox.item.body.getAsync("html", { asyncContext: "callback" }, function callback(result) {
        body = result.value;
    });
}

The Body content will be as Byte[]. 正文内容将为Byte []。 So that You can create a new document with this byte[]. 这样您就可以使用此byte []创建一个新文档。 Also you can get the Attachments. 您也可以获取附件。 So You can upload that too. 所以您也可以上传。 Let me know if this helps. 让我知道是否有帮助。

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

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