MS Graph API select "fields" 查询参数无效
MS Graph API select "fields" query parameter not working
使用 Graph API 获取列表项我可以在结果中看到 fields
:
https://graph.microsoft.com/v1.0/sites/{siteId}/lists/{listId}/items/{itemId}
然而,当我尝试在 select 中使用 fields
时,它没有显示:
https://graph.microsoft.com/v1.0/sites/{siteId}/lists/{listId}/items/{itemId}?select=id,fields
我猜 fields
是一个保留字,例如?expand=fields(...)
- 有人知道支持这一说法的文件吗?
- 或者知道如何在 select 查询参数中使用
fields
?
Someone know of documentation to support this claim?
Or know how to use fields in select query parameter?
关于你的第一个问题,我已经找到文档了。
对于你的第二个问题,根据我的测试,你只需要更正你的查询字符串:
https://graph.microsoft.com/v1.0/sites/xxxx.sharepoint.com/lists/aa8df67a-e7d7-4d33-a57a-20d8e08bf764/items/1?$expand=fields&$select=id,fields
结果如下:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites('xxx.sharepoint.com')/lists('aa8df67a-e7d7-4d33-a57a-20d8e08bf764')/items(id,fields)/$entity",
"@odata.etag": "\"c19fc274-2a75-48e9-bef1-e5cada2f0cd7,1\"",
"id": "1",
"fields@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites('xxx.sharepoint.com')/lists('aa8df67a-e7d7-4d33-a57a-20d8e08bf764')/items('1')/fields/$entity",
"fields": {
"@odata.etag": "\"c19fc274-2a75-48e9-bef1-e5cada2f0cd7,1\"",
"id": "1",
"ContentType": "Document",
"Created": "2018-06-04T09:55:06Z"
}
}
注意:现在不支持多级select,例如$select=id,fields.title
使用 Graph API 获取列表项我可以在结果中看到 fields
:
https://graph.microsoft.com/v1.0/sites/{siteId}/lists/{listId}/items/{itemId}
然而,当我尝试在 select 中使用 fields
时,它没有显示:
https://graph.microsoft.com/v1.0/sites/{siteId}/lists/{listId}/items/{itemId}?select=id,fields
我猜 fields
是一个保留字,例如?expand=fields(...)
- 有人知道支持这一说法的文件吗?
- 或者知道如何在 select 查询参数中使用
fields
?
Someone know of documentation to support this claim?
Or know how to use fields in select query parameter?
关于你的第一个问题,我已经找到文档了。 对于你的第二个问题,根据我的测试,你只需要更正你的查询字符串:
https://graph.microsoft.com/v1.0/sites/xxxx.sharepoint.com/lists/aa8df67a-e7d7-4d33-a57a-20d8e08bf764/items/1?$expand=fields&$select=id,fields
结果如下:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites('xxx.sharepoint.com')/lists('aa8df67a-e7d7-4d33-a57a-20d8e08bf764')/items(id,fields)/$entity",
"@odata.etag": "\"c19fc274-2a75-48e9-bef1-e5cada2f0cd7,1\"",
"id": "1",
"fields@odata.context": "https://graph.microsoft.com/v1.0/$metadata#sites('xxx.sharepoint.com')/lists('aa8df67a-e7d7-4d33-a57a-20d8e08bf764')/items('1')/fields/$entity",
"fields": {
"@odata.etag": "\"c19fc274-2a75-48e9-bef1-e5cada2f0cd7,1\"",
"id": "1",
"ContentType": "Document",
"Created": "2018-06-04T09:55:06Z"
}
}
注意:现在不支持多级select,例如$select=id,fields.title