问题
I try to set the sharepoint list items and update lists, right now the sharepoint list is a lookup with multiple value
I call
POST
/sites/{}/lists/{list_guid}/items/{item_id}/fields
with Json
{
"MyListLookUpValue":[
"LookupId":1,
"LookupValue":"My name",
"Email":"my@email.se",
]
}
(This isn't the code i use, but a representation)
I have found that i should specify the type but the thing is that i dont know the typ if it would be a list of Strings i could add
"MyListLookUpValue@odata.type":"Collection(Edm.String)"
Anyone that has this similar issue that you have to specify the type ?
Dont understand why they need to make it so hard.
{
"error": {
"code": "-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
"message": "A value without a type name was found and no expected type is available. When the model is specified, each value in the payload must have a type which can be either specified in the payload, explicitly by the caller or implicitly inferred from the parent value.",
"innerError": {
"request-id": "2aaa2c86-f922-414b-b9c9-f892588b0bea",
"date": "2019-02-28T17:05:05"
}
}
}
SOLUTION
After help from comments i got this answer which worked
{
"MyListLookUpValueLookupId@odata.type" : "Collection(Edm.Inte32)"
"MyListLookUpValueLookupId": [1,2,3]
}
来源:https://stackoverflow.com/questions/54929817/set-value-for-multiple-lookup-list-in-sharepoint-in-c-sharp