如何跨文档库搜索共享点文件 [英] How to search sharepoint file across document library

查看:19
本文介绍了如何跨文档库搜索共享点文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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"
            ]
        }
    ]
}

Specify select properties

这篇关于如何跨文档库搜索共享点文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆