Outlook Rest API:使用 Outlook Rest API 下载 .eml 文件类型的电子邮件附件 [英] Outlook Rest API: Download the email attachments of type .eml files using outlook rest API

查看:25
本文介绍了Outlook Rest API:使用 Outlook Rest API 下载 .eml 文件类型的电子邮件附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我关注了

如果电子邮件附件类型是 FileAttachment,我可以在 api 响应中获取文件内容并能够保存附件.如果电子邮件附件类型是 ItemAttachment,我无法在 api 响应中获取文件内容.当我搜索它时,我发现 this 堆栈溢出问题.我使用了答案中提到的其余 API.但它以 html 格式提供 itemAttachment 内容.如果该 ItemAttachment 中有任何 fileattachment ,那么我将无法访问它.

是否有任何 API 可用于将 itemAttachment 下载为 .eml 文件而不是 html?

欢迎任何建议/答案.

解决方案

我假设 .eml 你的意思是你想检索 MIME 格式的电子邮件?

Microsoft Graph API 目前不支持检索电子邮件的原始 MIME 内容.这是一个常见的请求,并且现有 UserVoice 请求它.

如果这是您的方案的硬性要求,您可能需要了解一下 Exchange Web 服务 (EWS).Message 对象返回EWS 包括 MimeContent 属性.

I followed this documentation to download the attachments of email.

Below is the API response.

If email attachment type is FileAttachment, I am able to get the file content in api response and able to save the attachment. If email attachment type is ItemAttachment, I am not able to get the file content in api response. When I googled for it, I found this stack overflow question. I used the rest API mentioned in the answer. But it's giving itemAttachment content in html format. And if that ItemAttachment has any fileattachment in it, then I am unable to access it.

Is there any API available to download the itemAttachment as .eml file not as html?

Any suggestion/answers would be more than welcome.

解决方案

I assume by .eml you mean you'd like to retrieve the email in MIME format?

Retrieving an email's raw MIME content isn't supported by Microsoft Graph API at this time. This has been a common request and there is an existing UserVoice request for it.

If this is a hard requirement for your scenario, you may want to take a look at Exchange Web Services (EWS). The Message object returned by EWS includes a MimeContent property.

这篇关于Outlook Rest API:使用 Outlook Rest API 下载 .eml 文件类型的电子邮件附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆