按元数据/列值的图形API搜索
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了按元数据/列值的图形API搜索相关的知识,希望对你有一定的参考价值。
我正在使用SharePoint网站上的MS Graph API开发应用程序。我正在尝试构建允许我在具有列参数的库中找到驱动器项的URL。
实际上,我建立了此获取URL来检索库中的驱动器项目:
https://graph.microsoft.com/v1.0/sites/ {mainSite}:/站点/ {子站点}:/列表/ {libname} /项目
我获取所有文件的JSON。
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Collection(microsoft.graph.list)('myLib')/items",
"value": [
...
{
"@odata.etag": ""7773c0de-bed1-425b-9065-2310c600757b,6"",
"createdDateTime": "2019-11-21T09:19:57Z",
"eTag": ""7773c0de-bed1-425b-9065-2310c600757b,6"",
"id": "24",
"lastModifiedDateTime": "2020-05-27T09:09:05Z",
"webUrl": "https://xxxx.sharepoint.com/sites/SUBSITE/myLib/Cartouche.docx",
"createdBy": {
"user": {
"email": "xxx@xxx.fr",
"id": "5fe24d57-1357-4fef-9cae-bfd79b0bf831",
"displayName": "David Vera"
}
},
"lastModifiedBy": {
"user": {
"email": "dvera@dsidiff.fr",
"id": "5fe24d57-1357-4fef-9cae-bfd79b0bf831",
"displayName": "David Vera"
}
},
"parentReference": {
"id": "1836034d-8a35-4488-995e-a7fe9cd30b4c",
"siteId": "xxx.sharepoint.com,82a2327c-e2cf-4d30-b529-31c3bcdcda5e,fbi3zrs9-b07a-4777-945b-3b42c5c876d"
},
"contentType": {
"id": "0x010100E4AD49D3A8873645A2803D49D2A4BF60"
}
},
...
]
}
我尝试使用过滤器:
https://graph.microsoft.com/v1.0/sites/ {mainSite}:/ sites / {subsite}:/ lists / {libname} / items?expand = fields(select = CODE_ANNONCEUR,val)&filter = fields / val eq'myself'
它返回我:
{
"error": {
"code": "-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
"message": "The expression « fields (select ») is not valid.",
"innerError": {
"request-id": "c3edc510-2d63-4f21-86cd-a377fb02d324",
"date": "2020-05-27T09:44:23"
}
}
}
答案
我通过这种方式解决了这个问题:
https://graph.microsoft.com/v1.0/sites/xxx.sharepoint.com:/sites/yyy:/lists/zzz/items?expand=fields/CODE_ANNONCEUR&filter=fields/CODE_ANNONCEUR eq 'stringExpected'
以上是关于按元数据/列值的图形API搜索的主要内容,如果未能解决你的问题,请参考以下文章