Eran Levy
Eran Levy

Reputation: 154

Update mail message body content using Microsoft Graph API

I'm trying to update the content of a received mail message that already exists in my inbox folder using the graph API. For some reason, the message is updated, but then immediately (a few seconds later), the message is reverted back to the original content.

Sometimes when this happens, I see some label on top of the message:

"This is the most recent version, but you made changes to another copy.."

Do you have any idea why?

I'm sending a PATCH request to /v1.0/users/<user-id>/messages/<message-id>

The sample request body is:

{
  "body": {
     "contentType": "HTML",
     "content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n</head>\r\n<body>\r\ntest\r\n</body>\r\n</html>\r\n"
  }
}

Upvotes: 4

Views: 2671

Answers (1)

Marc LaFleur
Marc LaFleur

Reputation: 33124

You can only update draft messages. From the documentation:

Property Type Description
body ItemBody The body of the message. Updatable only if isDraft = true.

In other words, you cannot PATCH received messages or those that have already been sent.

Upvotes: 2

Related Questions