4

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"
  }
}
Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
Eran Levy
  • 154
  • 10

1 Answers1

2

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.

double-beep
  • 5,031
  • 17
  • 33
  • 41
Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
  • Thank you, but I would expect Microsoft to at least block that api calls in addition to the documentation. I didnt pay attention to that isDraft=true and they still allow me to update that fields but with inconsistent response. Can you confirm that its just an API issue? – Eran Levy Jun 04 '19 at 07:50
  • Based on the documentation, tt sounds like this is by design. – Marc LaFleur Jun 04 '19 at 21:00
  • I am seeing a slightly different behavior. The message got updated, but it didn't revert even after an hours. Not sure if / when it will revert back to the original. Now that the updated message does not revert to original, I wonder if MS started to allow updates to received (not isDraft=true) message contents. If not, then MS must fix the API so it will return an error and not even a 'copy' of the message will be updated since the isDraft is always False for the received messages. – Urjit Jul 27 '20 at 10:34
  • June of 2022 here. You can definitely update the body of received emails sitting in your inbox. The documentation does still show "Updatable only if isDraft = true." I agree that this is confusing. Considering you can manually edit the message body of items directly in outlook, I would wager it is supposed to be allowed via the api. – Jacobalo Jun 23 '22 at 21:00