outlook-restapi - 是否可以使用 Outlook/Office 365 REST API 从电子邮件中检索 RFC 2822(或任何) header ?

标签 outlook-restapi

我正在开发的一个应用程序需要访问电子邮件的标题——特别是像 return-path 这样的标题。 , in-reply-to , 和 references .理想情况下,我们希望能够访问电子邮件的所有 RFC 2822 header 。 Outlook/Office 365 REST API 是否可以做到这一点?如果没有,是否可以使用任何 API?

最佳答案

更新: InternetMessageHeaders属性已添加到 Outlook API 的 beta 端点,因此您无需使用扩展属性即可获得此属性。您必须通过 $select 明确请求该属性。尽管。就像是:

GET https://outlook.office.com/api/beta/me/mailfolders/inbox/messages?
$select=Subject,InternetMessageHeaders

对于图表:该属性也存在于 Graph 的 beta 端点中的消息中,因此您可以执行以下操作:
GET https://graph.microsoft.com/beta/me/mailfolders/inbox/messages?
    $select=subject,internetMessageHeaders

对于非 beta 端点:API 不直接提供访问权限。但是,您可以访问 PidTagTransportMessageHeaders使用 Extended Property API 的 MAPI 属性.

从第一个链接中,我们看到 PidTagTransportMessageHeaders 的属性 ID是 0x7D , 类型为 String .所以$expand您的 GET 参数如下所示:
$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String 0x7D')

NOTE: This is only applicable for the Outlook endpoint (https://outlook.office.com). For Graph, see the answer from madsheep



将其与 GET 放在一起对于特定消息,您的请求可能如下所示:
GET https://outlook.office.com/api/v2.0/me/messages/{message-id}?
$select=Subject,SingleValueExtendedProperties
&$expand=SingleValueExtendedProperties($filter=PropertyId eq 'String 0x7D')

关于outlook-restapi - 是否可以使用 Outlook/Office 365 REST API 从电子邮件中检索 RFC 2822(或任何) header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38103388/

相关文章:

outlook - 在不同时区使用 Outlook 365 API 设置全天日历事件

node.js - 无法使用 NodeJS/node-outlook 访问 Office 365

android - Outlook - 阅读其他用户的日历

exchange-server - ResourceNotFound - 使用 Microsoft Graph API 访问混合 Exchange 设置中的本地邮箱

office365 - 修改重复序列中的单个事件不会反射(reflect)在从 Rest API 读取的数据中

python - 在 Outlook 中发送图表

python - Outlook RestAPI 无法正常工作

outlook-restapi - Outlook REST API与Microsoft Graph

office365 - Outlook 添加 REST 调用 : RequestBroker-ParseUri -- "Resource not found for the segment ' messages'. ”