1

I would like to retrieve all document libraries with the help of SharePoint(2010/2016) Search in a site.

I am using FQL and when I tried below I got all lists in particular site. Is this the right approach or is there a better approach for the same.

<QueryPacket xmlns='urn:Microsoft.Search.Query'>
    <Query>
        <SupportedFormats>
            <Format revision='1'>urn:Microsoft.Search.Response.Document:Document</Format>
        </SupportedFormats>
        <Context>
            <QueryText language='en' type='FQL'>and(filter(path:string(\"/Forms/AllItems.aspx\")),sitename:string(\"http://host/sitename\"))</QueryText>
        </Context>
        <ResultProvider>FASTSearch</ResultProvider>
        <Range><Count>10</Count></Range>
    </Query>
</QueryPacket>

Above approach is working fine in SharePoint 2010 but when I do the same in SharePoint 2016 it does not give any records. I would like to search "/Forms/AllItems.aspx" value in path field. It's working if I give the absolute URL but not for relative URL.

You can refer to below link on how to create test project for FQL.

https://msdn.microsoft.com/en-us/library/office/gg588339(v=office.14).aspx

EDIT(17-Nov)

As per @Lee_MSFT's response I tried my search criteria with "ContentClass:STS_List_DocumentLibrary" and it returns only document libraries. Because I need to search in the specific library, I added an additional filter for SiteName and it gave me the result but not all library.

So I tried below criteria with different properties but none of them gave me all libraries in a site.

SiteName:"http://site" ContentClass:"STS_List_DocumentLibrary
SPSiteURL:"http://site" ContentClass:"STS_List_DocumentLibrary"
Path:"http://site" ContentClass:"STS_List_DocumentLibrary"

Because none of above worked I tried below to see if I can get the document library that I am interested in and surprisingly got the record.

Path:"https://site/Documents/Forms/AllItems.aspx" ContentClass:"STS_List_DocumentLibrary"

So looks like when I search path with the absolute URL I get the library but when I try to search all library with contentclass it's not returning all libraries.

3

You could check the property contentclass:STS_List_DocumentLibrary.

One link for your reference:

http://avalagopi767.blogspot.sg/2016/02/sharepoint-2013-keyword-query-kql.html

  • If I am not wrong then this will return all documents with content type document library. I need list of all document libraries within a specific site. – Ravi Khambhati Nov 3 '17 at 10:57
  • Nope, this works perfectly to return the AllItems view for every Doc Lib you have access to. – Matthew McDermott Nov 3 '17 at 12:25
  • @RaviKhambhati so filter it by the specific site as well. There’s no reason why you cannot use more than one filter – Greg W Nov 4 '17 at 9:58
  • @Lee_MSFT content class approach worked but run into some other issue. Please have a look at the updated question. – Ravi Khambhati Nov 17 '17 at 18:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.