是否可以使用"架构扩展"更新office 365电子邮件标题。使用Microsoft Graph API

时间:2018-02-13 08:50:24

标签: odata office365 microsoft-graph office365api

我们正在尝试从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"
    }
  ]
}

在提问后:

Add custom headers and retrieive custom header using Microsoft Graph API

我想在下图中插入一些像EWS协议的标题:

enter image description here

P.S:

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

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

我怎样才能完全做到?

1 个答案:

答案 0 :(得分:2)

internetMessageHeaders属性是只读的。您不能直接通过Graph在传出消息上设置任意标题。

使用EWS,您必须在InternetHeaders属性集中设置扩展属性。你可以通过图表使用singleValueLegacyExtendedProperties进行一些挖掘:)。

首先,我们需要InternetHeaders属性集的GUID。从MS-OXPROPS开始,该值为00020386-0000-0000-C000-000000000046。因此,按照create a single-value extended property的说明,我们提出了一个属性ID:

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

现在我可以修改J POST有效负载I 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?"
      }
    ]
  }
}