我正在尝试使用 Microsoft Graph 创建 SharePoint ListItem .
除非我将这些方法应用于包含对象(如组、用户甚至图像)的列表,否则我用于 POST/PATCH ListItems
的方法是有效的。
在我的示例中,我将从 /beta/sites/root/lists/1231231231234/items/4/fields
发布、修补或获取。
SharePoint 列表项
{
"@odata.context":
"https://graph.microsoft.com/beta/$metadata#sites('root')/lists('1234123412341234')/items('4')/fields/$entity",
"@odata.etag": "\"123412341234,18\"",
"Title": "Test Title",
"description": "Some random description",
"assignedGroups": [
{
"LookupId": 7818,
"LookupValue": "7818",
"Email": "DemoGroep@12341234.onmicrosoft.com"
},
{
"LookupId": 7822,
"LookupValue": "7822",
"Email": "TestDemo@12341234.onmicrosoft.com"
}
],
"startDate": "2018-05-15T07:00:00Z",
"endDate": "2018-08-18T07:00:00Z",
"alwaysAvailable": false,
"id": "4",
"ContentType": "Item",
"Modified": "2018-05-17T13:27:21Z",
"Created": "2018-04-03T09:34:49Z",
"AuthorLookupId": "7688",
"EditorLookupId": "5222",
"_UIVersionString": "1.0",
"Attachments": false,
"Edit": "",
"LinkTitleNoMenu": "Test123123",
"LinkTitle": "Test123123",
"ItemChildCount": "0",
"FolderChildCount": "0",
"_ComplianceFlags": "",
"_ComplianceTag": "",
"_ComplianceTagWrittenTime": "",
"_ComplianceTagUserId": "",
"AppEditorLookupId": "25"
}
工作示例(注意:这是有效的,因为我更新了一个简单的字段,例如字符串类型的“标题”)
{
Title: "SomeNewTitle"
}
无效示例(返回 400“请求格式错误或不正确。”
)
{
assignedGroups: [{"Email": "Test1003@12341234o.onmicrosoft.com"}]
}
我在这里尝试了多种对象,但它从来没有用过。即使是空数组(以清除组成员身份)也返回 400
状态。
我感觉这是 Graph API 中的一个限制/错误
最佳答案
不幸的是,这是 Microsoft Graph 的 SharePoint API 的一个已知问题。有一个UserVoice request to fix this ,它绝对可以使用更多选票。
关于javascript - 无法使用 Microsoft Graph Api 创建带有 'Objects' 的列表项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50393157/