[英]Microsoft Azure Graph API download itemAttachment content
当我在office365网络浏览器页面中打开电子邮件时,可以选择下载附加到此电子邮件项目附件的内容 (使用Microsoft Outlook附加到当前的另一条消息) - * .eml文件,(contentType:RFC-822) )。
但是,当我试图通过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
}
]
}
任何想法如何通过Graph API(contentType = itemAttachment )获取附加的outlook消息的内容? fileAttachment contentType工作正常,我可以从Graph API响应的contentBytes属性中获取内容。 考虑以下API端点:
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}?$ expand =#microsoft.graph.itemAttachment / item
上述两者都不返回附加项的内容。
它是测试版,没有文档,但您可以使用Microsoft Graph API获取MIME内容:
GET https://graph.microsoft.com/beta/me/messages/{id}/$value
要么
GET https://graph.microsoft.com/beta/users/{id | userPrincipalName}/messages/{id}/$value
附件:
GET https://graph.microsoft.com/beta/users/{id}/messages/{id}/attachments/{id}/$value
通过响应,您可以创建扩展名为.eml的文件。
编辑:
现在它正式预览: https : //docs.microsoft.com/en-us/graph/outlook-get-mime-message
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.