简体   繁体   English

Microsoft Azure Graph API下载项目附件内容

[英]Microsoft Azure Graph API download itemAttachment content

When I open email message in the office365 web browser page, there is an option to DOWNLOAD contents of the attached to this email itemAttachment ( another message attached to the current one using Microsoft Outlook ) - *.eml file, (contentType: RFC-822). 当我在office365网络浏览器页面中打开电子邮件时,可以选择下载附加到此电子邮件项目附件的内容 (使用Microsoft Outlook附加到当前的另一条消息) - * .eml文件,(contentType:RFC-822) )。

在此输入图像描述

However, when I'm trying to get the contents of this itemAttachment through Graph API (same operation), the contentBytes response property is not present. 但是,当我试图通过Graph API(相同的操作)获取此itemAttachment的内容时,contentBytes响应属性不存在。

{
    "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('bbbbb')/messages('fffff')/attachments",
    "value": [{
            "@odata.type": "#microsoft.graph.itemAttachment",
            "id": "gggg",
            "lastModifiedDateTime": "2017-02-13T16:29:45Z",
            "name": "The Daily Build - Compiling your C code to .NET",
            "contentType": "message/rfc822",
            "size": 99129,
            "isInline": false
        }
    ]
}

Any ideas how to get contents of attached outlook message though Graph API ( contentType= itemAttachment )? 任何想法如何通过Graph API(contentType = itemAttachment )获取附加的outlook消息的内容? The fileAttachment contentType is working fine, I can grab the contents from the contentBytes property of the Graph API response. fileAttachment contentType工作正常,我可以从Graph API响应的contentBytes属性中获取内容。 The following API endpoints are considered: 考虑以下API端点:

https://graph.microsoft.com/beta/me/messages/ {id}/attachments https://graph.microsoft.com/beta/me/messages/ {id} / attachments

https://graph.microsoft.com/beta/me/messages/ {id}/attachments/{attachmentId} https://graph.microsoft.com/beta/me/messages/ {id} / attachments / {attachmentId}

https://graph.microsoft.com/beta/me/messages/ {id}/attachments/{attachmentId}?$expand=#microsoft.graph.itemAttachment/item https://graph.microsoft.com/beta/me/messages/ {id} / attachments / {attachmentId}?$ expand =#microsoft.graph.itemAttachment / item

neither of the above returns contents of the attached Item. 上述两者都不返回附加项的内容。

It's in beta and there isn't a documentation, but you can get MIME content with Microsoft Graph API: 它是测试版,没有文档,但您可以使用Microsoft Graph API获取MIME内容:

GET https://graph.microsoft.com/beta/me/messages/{id}/$value

or 要么

GET https://graph.microsoft.com/beta/users/{id | userPrincipalName}/messages/{id}/$value

Attachments: 附件:

GET https://graph.microsoft.com/beta/users/{id}/messages/{id}/attachments/{id}/$value

With the response you can create a file with .eml extension. 通过响应,您可以创建扩展名为.eml的文件。

Edit: 编辑:

Now it's officially in preview: https://docs.microsoft.com/en-us/graph/outlook-get-mime-message 现在它正式预览: https//docs.microsoft.com/en-us/graph/outlook-get-mime-message

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

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