1

In order to organize emails into single thread GMail requires custom headers to be set within incoming message. Is there any way to set custom headers when sending Office O365 Outlook message through the Graph API? The documentation states about custom headers option through the InternetMessageHeaders property, however it is required to start header name with 'x-' appendix, which makes it not usable. For example, this message is supposed to set some custom headers, however, due to the 'x-' prefix limitation, this can't be used for organizing GMail messages:

POST https://graph.microsoft.com/v1.0/me/sendMail
Content-type: application/json

{
  "message": {
    "subject": "9/9/2018: concert",
    "body": {
      "contentType": "HTML",
      "content": "The group represents Nevada."
    },
    "toRecipients": [
      {
        "emailAddress": {
          "address": "[email protected]"
        }
      }
    ],
    "internetMessageHeaders":[
      {
        "name":"x-custom-header-group-name",
        "value":"Nevada"
      },
      {
        "name":"x-custom-header-group-id",
        "value":"NV001"
      }
    ]
  }
}

https://learn.microsoft.com/en-us/graph/api/user-sendmail?view=graph-rest-1.0&tabs=http

Is there any way to specify custom headers: 'References', 'In-Reply-To' without the prefix 'x-'? https://gsuiteupdates.googleblog.com/2019/03/threading-changes-in-gmail-conversation-view.html

enter image description here

When trying to set custom email headers without 'x-' prefix, the Graph API returns following error message:

{
    "error": {
        "code": "InvalidInternetMessageHeader",
        "message": "The internet message header name 'References' should start with 'x-' or 'X-'.",
        "innerError": {
            "request-id": "441e21b7-d4ca-47d3-957a-a72bcc854a67",
            "date": "2019-12-10T14:28:35"
        }
    }
}

1 Answer 1

4

One workaround might be to use the Extended properties to set those values eg the In-Reply-to https://learn.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtaginreplytoid-canonical-property should look something like

"singleValueExtendedProperties": [
 {
       "id":"String 0x1042",
       "value":"[email protected]"
 }
]
Sign up to request clarification or add additional context in comments.

1 Comment

setting both headers: References "String 0x1039" and In-Reply-To "String 0x1042" solved the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.