如何跨文档库搜索共享点文件 [英] How to search sharepoint file across document library
问题描述
I'm trying to search files in SharePoint with GET https://graph.microsoft.com/v1.0/sites/root/drive/root/search(q='text file')
but it searches only in the root site. Is there any way to search across the document library using graph API?
Something similar to POST https://graph.microsoft.com/v1.0/search/query
. This endpoint searches files across the document library.
Is it possible to implement the POST
api call behavior in the GET
api call? Why because the response from POST
api call doesn't provide information about file-mimeType, so I need to switch to GET
api call.
You can specify the fields you want back in the response, as part of the fields sub-property. Specify mimeType
.
To retrieve a custom property for a driveItem
, query listItem
instead.
POST https://graph.microsoft.com/v1.0/search/query
Request body
{
"requests": [
{
"entityTypes": [
"listItem"
],
"query": {
"queryString": "text file"
// filter by contentClass
//"queryString": "text file contentclass:STS_ListItem_DocumentLibrary"
},
"fields": [
"id",
"fileName",
"contentClass",
"createdDateTime",
"lastModifiedDateTime",
"webUrl",
"sharepointIds",
"createdBy",
"modifiedBy",
"parentReference",
"mimeType",
"fileType"
]
}
]
}
这篇关于如何跨文档库搜索共享点文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!