Microsoft Graph更新SharePoint列表项多选字段
问题描述:
使用Microsoft Graph更新多选列表项字段的正确JSON语法是什么?
What is the proper JSON syntax to update a multi-choice list item field using the Microsoft Graph?
多选字段返回字符串的json数组,例如:
Multi choice fields return a json array of strings like:
获取:/v1.0/sites/{siteId}/lists/{listId}/items/{itemId}
"CAG_x0020_Process_x0020_Status": [
"Proposed Funding - Customer Billed",
"Proposed Funding - Sales Funded",
"SOW - Needed"
]
但是,当使用相同的语法更新字段时,将返回400个无效请求.
However, when using the same syntax to update the field a 400 invalid request is returned.
匹配:/v1.0/sites/{siteId}/lists/{listId}/items/{itemId}/fields
"CAG_x0020_Process_x0020_Status": [
"Proposed Funding - Customer Billed",
"Proposed Funding - Sales Funded",
"SOW - Needed"
]
返回错误:
{
"error": {
"code": "invalidRequest",
"message": "The request is malformed or incorrect.",
"innerError": {
"request-id": "2251e25f-e4ce-491f-beb9-e463c7d8d5af",
"date": "2018-05-16T15:16:23"
}
}
}
我能够更新所有其他要求的字段,但是最后一个字段阻止了该应用程序的发布.
I am able to update all other fields requested, but this last field is holding up a release of the application.
答
这对我有用
graph.api(url)
.version('beta')
.post({
'fields': {
'AssignedToLookupId@odata.type': 'Collection(Edm.Int32)',
'AssignedToLookupId': [5,13]
}
});