我已成功使用Dynamics 365 Web API的$batch
端点创建了许多约会。
https://myorg.com/api/data/v8.2/$batch
请求正文看起来像这样:
--batch_AAA123
Content-Type: multipart/mixed;boundary=changeset_BBB456
--changeset_BBB456
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-ID: 1
POST https://myorg.com/api/data/v8.2/appointments HTTP/1.1
Content-Type: application/json;type=entry
{ ... JSON for appointment ... }
--changeset_BBB456
Content-Type: application/http
Content-Transfer-Encoding:binary
Content-ID: 2
POST https://myorg.com/api/data/v8.2/appointments HTTP/1.1
Content-Type: application/json;type=entry
{ ... JSON for appointment ... }
--changeset_BBB456--
--batch_AAA123--
我没有使用appointments
端点,而是使用Book
操作。
https://myorg.com/api/data/v8.2/Book
我可以单独成功完成此任务:
{
"Target": {
"@odata.type": "Microsoft.Dynamics.CRM.appointment",
"subject": "Created using Book action",
"scheduledstart" : "2018-01-18T09:00:00Z",
"scheduledend": "2018-01-18T10:00:00Z",
"statecode" : 3,
"statuscode" : 5,
"ownerid@odata.bind":"/systemusers(f6c98954-66d3-e711-80eb-3863bb342b28)",
"appointment_activity_parties" : [
{
"partyid_systemuser@odata.bind" : "/systemusers(f6c98954-66d3-e711-80eb-3863bb342b28)",
"participationtypemask" : 7
}
],
"regardingobjectid_account@odata.bind": "/accounts(8df157f6-fcf5-e711-80ef-3863bb34ecf0)"
}
}
现在我想通过Book
使用$batch
操作但我收到错误:
VerifyCommitted - 尚未提交交易
除了长堆栈跟踪之外,没有进一步的细节。
我相信如果单独进行预订会成功(没有日程安排冲突等)。
我是做错了还是Web API根本不支持批量操作?