是否可以使用 "schema extensions" 和 Microsoft Graph API 更新 office 365 电子邮件 Headers

Is it possible to update office 365 Email Headers using "schema extensions" with Microsoft Graph API

我们正在尝试将 EWS 转换为 Microsoft Graph API,我看到基本 "schema extensions" 和 api:GET - https://graph.microsoft.com/v1.0/me/messages

响应是:

{
  "value": [
    {
      "receivedDateTime": "datetime-value",
      "sentDateTime": "datetime-value",
      "hasAttachments": true,
      "subject": "subject-value",
      "body": {
        "contentType": "",
        "content": "content-value"
      },
      "bodyPreview": "bodyPreview-value"
    }
  ]
}

在提问之后:

我想插入一些 headers 如下图所示的 EWS 协议:

P.S:

我看到它在测试版中是可行的:

https://github.com/microsoftgraph/microsoft-graph-docs/blob/master/api-reference/beta/resources/internetmessageheader.md

我怎样才能准确地做到这一点??

internetMessageHeaders 属性 是 read-only。您不能直接通过 Graph 对外发消息设置任意 headers。

使用 EWS,您必须在 InternetHeaders 属性 集中设置扩展 属性。您可以使用 singleValueLegacyExtendedProperties 通过 Graph 做同样的事情,稍微挖掘 :).

首先,我们需要 InternetHeaders 属性 集合的 GUID。从 MS-OXPROPS, that value is 00020386-0000-0000-C000-000000000046. So following along with the instructions to create a single-value extended property,我们想出了一个 属性 id,例如:

String {00020386-0000-0000-C000-000000000046} Name X-MY-COMPANY-INVOICE

现在我可以将 JSON 有效载荷修改为 POST 到 /sendMail 端点以包含此 属性 值:

{
  "message": {
    "subject": "Meet for lunch?",
    "body": {
      "contentType": "Text",
      "content": "The new cafeteria is open."
    },
    "toRecipients": [
      {
        "emailAddress": {
          "address": "adelev@contoso.com"
        }
      }
    ],
    "singleValueExtendedProperties": [
      {
        "id": "String {00020386-0000-0000-C000-000000000046} Name X-MY-COMPANY-INVOICE",
        "value": "This is my value that I put here. Isn't it neat?"
      }
    ]
  }
}