使用 Microsoft Graph 更新邮件正文内容 API

Update mail message body content using Microsoft Graph API

我正在尝试使用图表 API 更新收件箱文件夹中已存在的已收到邮件的内容。由于某种原因,消息被更新,但立即(几秒钟后),消息又恢复为原始内容。

有时发生这种情况时,我会在邮件顶部看到一些标签:

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

你知道为什么吗?

我正在向 /v1.0/users/<user-id>/messages/<message-id>

发送 PATCH 请求

示例请求正文是:

{
  "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"
  }
}

您只能更新消息草稿。来自 documentation:

The body of the message. Updatable only if isDraft = true.

换句话说,您不能PATCH收到消息或已经发送的消息。