🔄
Microsoft Graph でも SharePoint リスト アイテムの複数の値を持つ列が更新できない
SharePoint REST API の時代から、複数の値を持つ列 (MultiChoice、UserMulti、LookupMulti) を更新できないという問題があります。英語フォーラムの情報でも、できるという情報とできないという情報が混在していますが、少なくとも筆者が試した限りでは解決できていません。
具体的には、以下のようなリクエストを送信すると 400 エラーが返されます。
POST https://{{tenant-name}}.sharepoint.com/_api/web/lists('{{list-id}}')/items({{item-id}})
Authorization: Bearer {{access-token}}
Accept: application/json; odata=verbose
Content-Type: application/json; odata=verbose
{
"__metadata": {
"type": "SP.ListItem"
},
"ChoiceField": {
"results": [
"Test Value"
]
}
}
Microsoft.SharePoint.Client.InvalidClientQueryException: 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.
この問題が Microsoft Graph で改善されているかどうかを確認するために試してみましたが、現時点では改善されていません。
{
"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.",
}
}
Microsoft Graph API は SharePoint の内部実装に依存しているため、これは仕様どおりといえますが、改善されていない点は残念です。
Discussion