首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Microsoft下载itemAttachment内容

Microsoft下载itemAttachment内容
EN

Stack Overflow用户
提问于 2017-02-13 17:55:58
回答 1查看 1.6K关注 0票数 2

当我在Microsoft浏览器页面中打开电子邮件消息时,有一个选项可以下载附加到此电子邮件itemAttachment (另一条使用Microsoft附加到当前邮件的邮件)- *.eml文件(contentType: RFC-822)的内容。

但是,当我试图通过Graph (相同的操作)获取这个itemAttachment的内容时,contentBytes响应属性不存在。

代码语言:javascript
运行
复制
{
    "@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

上述任何一项都不返回所附项的内容。

EN

回答 1

Stack Overflow用户

发布于 2019-03-27 17:04:21

它在beta版,没有文档,但是您可以使用Microsoft获得MIME内容:

代码语言:javascript
运行
复制
GET https://graph.microsoft.com/beta/me/messages/{id}/$value

代码语言:javascript
运行
复制
GET https://graph.microsoft.com/beta/users/{id | userPrincipalName}/messages/{id}/$value

附件:

代码语言:javascript
运行
复制
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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42210430

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档