当我在Microsoft浏览器页面中打开电子邮件消息时,有一个选项可以下载附加到此电子邮件itemAttachment (另一条使用Microsoft附加到当前邮件的邮件)- *.eml文件(contentType: RFC-822)的内容。
但是,当我试图通过Graph (相同的操作)获取这个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
}
]
}
如何通过图形API ( contentType=itemAttachment )获取附加outlook消息的内容?fileAttachment contentType运行良好,我可以从Graph响应的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
上述任何一项都不返回所附项的内容。
发布于 2019-03-27 17:04:21
它在beta版,没有文档,但是您可以使用Microsoft获得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://learn.microsoft.com/en-us/graph/outlook-get-mime-message
https://stackoverflow.com/questions/42210430
复制相似问题