Id是SharePoint列表中的现成字段。
我正在使用graph-explorer测试:https://developer.microsoft.com/en-us/graph/graph-explorer
我尝试过使用这些过滤器
https://graph.microsoft.com/v1.0/sites/root/lists/ba0dc64a-263c-44b6-8160-66a3034a1429/items?$ expand = fields&$ filter = fields /标题eq'1'
https://graph.microsoft.com/v1.0/sites/root/lists/ba0dc64a-263c-44b6-8160-66a3034a1429/items?$ expand = fields&$ filter = fields / id eq'1'
{
"error": {
"code": "invalidRequest",
"message": "A provided field name is not recognized",
"innerError": {
"request-id": "9f0bd335-bf60-42dd-893e-397fe62bc890",
"date": "2019-05-01T00:25:51"
}
}
}
https://graph.microsoft.com/v1.0/sites/root/lists/ba0dc64a-263c-44b6-8160-66a3034a1429/items?$ expand = fields&$ filter = fields / Id eq 1
{
"error": {
"code": "BadRequest",
"message": "Invalid filter clause",
"innerError": {
"request-id": "730490af-6b08-4ac1-8259-fa9bb9dd9e46",
"date": "2019-05-01T00:26:28"
}
}
}
答案 0 :(得分:0)
单个{em> ListItem
资源可以通过Id
来寻址(有关更多详细信息,请参考Get item端点):
GET https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items/{item-id}?$expand=fields
其中
site-id
-Site
资源的标识符list-id
-List
资源的标识符item-id
-ListItem
资源的标识符要通过ID检索多个项目,可以使用JSON batch endpoint,例如:
POST https://graph.microsoft.com/v1.0/$batch
Accept: application/json
Content-Type: application/json
Body:
{
"requests": [
{
"id": "1",
"method": "GET",
"url": "/sites/root/lists/{list-id}/items/{item_id-1}/"
},
{
"id": "2",
"method": "GET",
"url": "/sites/root/lists/{list-id}/items/{item_id-2}/"
}
]
}