无法使用 API 更改记录的所有者 ID

问题描述 投票:0回答:1

我正在尝试使用 Dynamics CRM 中的 REST api 更新帐户所有者(通过使用“分配”按钮设置的所有者)。 我的请求如下:

uri: [Organization URI]/api/data/v9.0/accounts(AccountID)
Request type: Patch
Request body: "[email protected]": "/systemusers(UserID)"

问题是我收到以下错误:

message=Error identified in Payload provided by the user for Entity :'', For more information on this error please follow this help link https://go.microsoft.com/fwlink/?linkid=2195293  ---->  InnerException : System.ArgumentException: Stream was not readable.
   at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean leaveOpen)
   at System.IO.StreamReader..ctor(Stream stream, Encoding encoding)
   at Microsoft.OData.JsonLight.ODataJsonLightInputContext.CreateTextReader(Stream messageStream, Encoding encoding)
   at Microsoft.OData.JsonLight.ODataJsonLightInputContext..ctor(ODataMessageInfo messageInfo, ODataMessageReaderSettings messageReaderSettings)
   at Microsoft.OData.Json.ODataJsonFormat.CreateInputContext(ODataMessageInfo messageInfo, ODataMessageReaderSettings messageReaderSettings)
   at Microsoft.OData.ODataMessageReader.ReadFromInput[T](Func`2 readFunc, ODataPayloadKind[] payloadKinds)
   at System.Web.OData.Formatter.Deserialization.ODataResourceDeserializer.Read(ODataMessageReader messageReader, Type type, ODataDeserializerContext readContext)
   at System.Web.OData.Formatter.ODataMediaTypeFormatter.ReadFromStream(Type type, Stream readStream, HttpContent content, IFormatterLogger formatterLogger).

查看这里的Dynamics文档:Dynamics Docs,我认为我应该在有效负载中使用的字段是ownerid_accounts,但请求仍然失败。

谁能告诉我我的请求有什么问题吗?

谢谢你。

dynamics-crm
1个回答
0
投票

负载似乎无效。尝试使用以下方法:

{"[email protected]": "/systemusers(UserID)"}
© www.soinside.com 2019 - 2024. All rights reserved.