X-Reply-To header not changing Reply-To in Microsoft Graph API

DJ-MoMo 0 Reputation points
2023-10-31T17:06:07.16+00:00

Here is what I'm doing in my API call:

Creating a Message object

Setting the X-Reply-To header to my custom email:


**message.Headers.Add("X-Reply-To", "******@email.com");**

Sending the email via the Graph API

When looking at the full headers of the sent message, I can see the X-Reply-To field populated correctly. But the Reply-To remains unchanged.

I expected that setting X-Reply-To would override or change the Reply-To field as well, but that doesn't seem to be the case.

Is there something else I need to do to get X-Reply-To to actually modify Reply-To when sending through the Graph API? Or is this not possible and I have to find another approach?

Any help or insights appreciated! I'm using Microsoft 365 with the latest Graph API.

Outlook | Windows | Classic Outlook for Windows | For business
Microsoft Security | Microsoft Graph

2 answers

Sort by: Most helpful
  1. Glen Scales 4,376 Reputation points
    2023-11-01T00:33:19.2033333+00:00

    The replyTo property is strongly typed in the Graph so you just need to use that property in you request eg

    {
        "message": {
            "subject": "Meet for lunch?",
            "body": {
                "contentType": "Text",
                "content": "The new cafeteria is open."
            },
            "toRecipients": [
                {
                    "emailAddress": {
                        "address": "******@domain.com"
                    }
                }
            ],
            "replyTo": [
                {
                    "emailAddress": {
                        "address": "******@domain.com"
                    }
                }
            ]
        }
    }
    

    Was this answer helpful?

    1 person found this answer helpful.

  2. LaserGecko 0 Reputation points
    2024-07-08T17:28:12.29+00:00

    The ReplyTo does get added to the email by adding "x-Reply-To"through Microsoft Graph API.

    @DJ-MoMo That is incorrect. That header is sent by MS Graph, but it is not set by you as a header. As of July 8, 2024, only custom headers are supported.

    replyTo is sent in the payload since, just like "body", "subject", and "toRecipients", it is a property of the message resource.

    If the address is not changed after being sent correctly, it's either an MS Graph error or an Entra authorization issue.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.