412(前提条件失败)同时添加附件时

Hon*_*iao 5 outlook microsoft-graph

我正在使用Microsoft Graph。我尝试通过添加两个附件

POST /me/messages/{messageId}/attachment

{
  "@odata.type": "#microsoft.graph.fileAttachment",
  "name": "1.txt",
  "contentBytes": "SGVsbG8gd29ybGQh"
}

POST /me/messages/{messageId}/attachment

{
  "@odata.type": "#microsoft.graph.fileAttachment",
  "name": "2.txt",
  "contentBytes": "SGVsbG8gd29ybGQhIQ=="
}
Run Code Online (Sandbox Code Playgroud)

当我同时添加这两个附件时,它给了我412错误(前提条件失败)

{
  "code": "ErrorIrresolvableConflict",
  "message": "The send or update operation could not be performed because the change key passed in the request does not match the current change key for the item., Cannot save changes made to an item to store.SaveStatus: IrresolvableConflict\r\nPropertyConflicts:\r\n",
  "innerError": {
    "request-id": "20e95141-5d2d-41e3-8eed-3bbd24bcf52a",
    "date": "2017-11-28T07:18:45"
  }
}
Run Code Online (Sandbox Code Playgroud)

Hon*_*iao 1

现在,解决方法是将第二个 POST 延迟大约 100 毫秒。如果小于100毫秒,失败的可能性就更大。(失败的几率也可能与附件的大小有关,我没有做进一步的测试)

但如果我有 10 个附件,每两次 POST 之间就会有 100 毫秒的延迟。

顺便说一句,我看到这个问题甚至存在于 Outlook 客户端中,当人们发送邮件时,他们得到了同样的错误:检查这里。所以这可能是服务器问题。

[只需从我原来的问题转移到答案]