解决深度插入导航属性Dynamics WebAPI时的错误 [英] Resolve error on deep insert of navigation property Dynamics WebAPI
问题描述
我正在使用 Microsoft Dynamics Web API 写入数据到Microsoft Dynamics 365中的实体.当我尝试执行
I am using the Microsoft Dynamics Web API to write data to an entity in Microsoft Dynamics 365. When I try to do a deep insert I am receiving the error
未声明的属性"ccseq_employeeid",仅在有效负载中具有属性注释,而在有效负载中未找到属性值.在OData中,只有声明的导航属性和声明的命名流可以表示为没有值的属性.
An undeclared property 'ccseq_employeeid' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values.
为什么我会收到此错误?如何解决该错误?
Why am I receiving this error and how can I resolve the error?
{
"ccseq_importdate" : "2017-05-28T04:00:00Z",
"ccseq_month" : "1",
"ccseq_year" : "2017",
"ccseq_name" : "Test",
"ccseq_status" : "100000000", "ccseq_ccseq_expensetransactionset_ccseq_expensetransaction_ExpenseTransactionSetID" :
[
{
"ccseq_employeeid@odata.bind": "/systemusers(6d2fd71b-32d1-dd11-a4f5-001a6449bbe7)",
"ccseq_clientid@odata.bind": "/ccseq_clients(663ebd00-73b9-4faf-90ed-f56bb9c2dc9b)",
"ccseq_navemployeeid" : "11111",
"ccseq_employeefirstname" : "John"
}
]
}
ExpenseTransactionSet
是ExpenseTransaction
的父级,这意味着ExpenseTransaction
具有对ExpenseTransactionSet
的查找. ccseq_ccseq_expensetransactionset_ccseq_expensetransaction_ExpenseTransactionSetID
是一对多关系. systemuser
和ccseq_clients
是在ExpenseTransaction
中进行查找的单独实体.
ExpenseTransactionSet
is the parent of ExpenseTransaction
meaning that ExpenseTransaction
has a lookup to ExpenseTransactionSet
. ccseq_ccseq_expensetransactionset_ccseq_expensetransaction_ExpenseTransactionSetID
is one to many relationship. systemuser
and ccseq_clients
are separate entities that are lookups in ExpenseTransaction
.
我还在"ccseq_employeeid@odata.bind"
-
objectid_systemuser@odata.bind
-
objectid_ccseq_employeeid@odata.bind
-
ccseq_employeeid@data.bind
-
ccseq_employeeid@odata.bind : systemusers()
-
ccseq_employeeid_systemusers@odata.bind
-
systemuserid_systemusers@odata.bind
objectid_systemuser@odata.bind
objectid_ccseq_employeeid@odata.bind
ccseq_employeeid@data.bind
ccseq_employeeid@odata.bind : systemusers()
ccseq_employeeid_systemusers@odata.bind
systemuserid_systemusers@odata.bind
我已经看到此问题和这个问题,并尝试了建议的解决方案,但没有成功.
I have seen this question and this question and tried the suggested resolutions without success.
推荐答案
我发现阅读此线程.深度插入中导航属性的正确语法是使用子实体名称",后跟带有字段名称的方括号. json需要更改为以下
I discovered the answer reading this thread. The correct syntax for a Navigation Property in a deep insert is to use the Child Entity Name followed by brackets with the field name. The json needs to be changed to the below
{
"ccseq_importdate" : "2017-05-28T04:00:00Z",
"ccseq_month" : "1",
"ccseq_year" : "2017",
"ccseq_name" : "Test",
"ccseq_status" : "100000000",
"ccseq_ccseq_expensetransactionset_ccseq_expensetransaction_ExpenseTransactionSetID" :
[
{
// Next two lines are changed
"ExpenseTransaction[ccseq_employeeid@odata.bind]": "/systemusers(6d2fd71b-32d1-dd11-a4f5-001a6449bbe7)",
"ExpenseTransaction[ccseq_clientid@odata.bind]": "/ccseq_clients(663ebd00-73b9-4faf-90ed-f56bb9c2dc9b)",
"ccseq_navemployeeid" : "11111",
"ccseq_employeefirstname" : "John"
}
]
}
这篇关于解决深度插入导航属性Dynamics WebAPI时的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!