Issue with Microsoft Graph API - Updating a Message

Fabio Bove 0 Reputation points
2024-08-27T08:16:49.6033333+00:00

Hello,

We are experiencing an issue with the Microsoft Graph API, specifically with the function to update a message.

According to the documentation available at the following link: https://learn.microsoft.com/en-us/graph/api/message-update?view=graph-rest-1.0&tabs=http, it is possible to modify the "replyTo" attribute of an existing message when it is in draft mode (isDraft=True). However, when we attempt to execute this call, it does not seem to work, even though it returns a status code 200.

Below are the details of my HTTP request:

  • Endpoint used:
  • Attribute I am trying to modify: "replyTo"
  • Response received: Status code 200

Here is the code snippet of the function used:


defdef update_email_data(email_id, new_data):
    api_endpoint = f"{ms_graph_endpoint}/{user_id}/mailFolders/Inbox/messages/{email_id}"
    response = requests.patch(api_endpoint, headers=graph_manager.headers, json=new_data)
    updated_email_id = response.json()["id"]
    return response, updated_email_id

Data passed for the update:



data = {
    "subject": "TEST",
    "toRecipients": [
        {
            "emailAddress": {
                "name": "my_username",
                "address": "my_personal_email"
            }
        }
    ],
    "replyTo": [
        {
            "emailAddress": {
                "name": "my_username",
                "address": "my_personal_email"
            }
        }
    ]
}
resp, _ = update_email_data(email_id=retrieved_email_id, new_data=data)

We have verified that the message ID and other request details are correct. Additionally, other attributes such as 'subject' and "toRecipients" are being correctly modified.

Could you please assist us in resolving this issue? Is it possible that there are additional restrictions or requirements for modifying the "replyTo" attribute?

Thank you in advance for your support.

Best regards, F.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,829 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rohit Raghuwanshi - MSFT 240 Reputation points Microsoft Vendor
    2024-08-28T11:03:53.3133333+00:00

    Hi Fabio Bove,

    Thank you for reaching out, Microsoft!

    I attempted to replicate this scenario on my end and successfully updated the 'reply to' property using the Graph API PATCH /me/mailFolders/{id}/messages/{id} for a message marked as 'isDraft=True'. Kindly refer to the screenshot below for reference.

    1. Initial Email ( replyTo =[ ] ) :

    User's image

    1. Patch request to update email reply to property:

    User's image

    1. Response from above request showing updated reply to which can we verified in UI as well:

    User's image

    Please verify Draft Status: Ensure the message is indeed in draft mode (isDraft=True). The “replyTo” attribute can only be updated if the message is a draft, which is returned by request GET /me/mailFolders/{id}/messages/{id}.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

Your answer

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