MS Graph API选择“字段”查询参数不起作用

时间:2018-08-10 05:38:44

标签: office365 microsoft-graph sharepoint-online

使用Graph API获取列表项,我可以在结果中看到fieldshttps://graph.microsoft.com/v1.0/sites/{siteId}/lists/{listId}/items/{itemId} enter image description here

但是,当我尝试在选择中使用fields时,它不会显示: https://graph.microsoft.com/v1.0/sites/{siteId}/lists/{listId}/items/{itemId}?select=id,fields

enter image description here

我的猜测是fields是保留字,例如?expand=fields(...)

  • 有人知道支持这一说法的文档吗?
  • 还是知道如何在选择查询参数中使用fields

1 个答案:

答案 0 :(得分:0)

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 = id,fields.title