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'>
            <Format revision='1'>urn:Microsoft.Search.Response.Document:Document</Format>
            <QueryText language='en' type='FQL'>and(filter(path:string(\"/Forms/AllItems.aspx\")),sitename:string(\"http://host/sitename\"))</QueryText>

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.



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.

  • Late comment: To filter for a site, use an asterix/wildcard at the end of the path: Path:"https://site/*" ContentClass:"STS_List_DocumentLibrary"
    – poke
    Jan 10, 2020 at 1:19

1 Answer 1


You could check the property contentclass:STS_List_DocumentLibrary.

One link for your reference:


  • 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. Nov 3, 2017 at 10:57
  • Nope, this works perfectly to return the AllItems view for every Doc Lib you have access to. Nov 3, 2017 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, 2017 at 9:58
  • @Lee_MSFT content class approach worked but run into some other issue. Please have a look at the updated question. Nov 17, 2017 at 18:21
  • @MatthewMcDermott What if we don't want to return AllItems view, but another custom view for the document library, is that possible? Almost like filter it out...
    – klewis
    Apr 19, 2021 at 22:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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