How to create a CQWP that filter all the site's document libraries using metadata.
I already defined the metadata terms and added columns based on them on my document libraries.
Th problem is that when I create a CQWP it only allows me to choose ONE List.
How is it possible to query all the document libraries in my site ?

(I want to list all the documents in all my document libraries that have column Language = ENG for example)

2 Answers 2


First I would recommend you use the Content Query web part. You can define and test your search query and it is very easy to pull back just document libraries with certain metadata. If you don't have the Enterprise edition of SharePoint than that wont be avialbale but you can use the Search Results webpart which is similar.

If you still want to use the CQWP you don't select a specific list. You target your site and then pull in by content type. To further refine it via metadata I believe you will need to export it and refine your CAML query inside the XML, then re-upload it to your web part library. It's been a long time since I've played with CQWP because the above two solution work 95% of the time for me.

  • I'm working on the Enterprise Edition, is it possible to query multiple Lists on the same time ?
    – Mehdi
    Commented Oct 22, 2014 at 14:25
  • Absolutely, and it's fairly intuitive. Drop a content search part on the page and look at the properties. It has a GUI for configuring custom search parameters. You customize the results as well with display templates. It is one of my favorite additions to SP2013. See MSDN refrence: msdn.microsoft.com/en-us/library/office/… Commented Oct 22, 2014 at 14:35
  • And it is not possible with CQWP without redifining the CAML Query ? unless putting all documents into the same List ...
    – Mehdi
    Commented Oct 22, 2014 at 15:43
  • I don't think so. Again it's been a while since I've spent significant time with CQWP. If you can't do it in properties pane - then the answer is no. Commented Oct 22, 2014 at 17:23
  • I found a solution with the CQWP using site columns as a filter in the query parameters.
    – Mehdi
    Commented Oct 30, 2014 at 16:03

To query multiple document librarires on the same Content Query we should define site columns, add them to the document librarires and use them as filters in the Content Query parameters :

  1. Define the site columns :
    Site Settings > Web Designer Galleries > Site Columns Here we can create our site column, for example : MyFilter (Note that this column can be based on Managed Metadata) and define its values, for example Filter_1 / Filter_2
  2. Add the site column on the document libraries :
    The next step consists of adding this new column on all document librarires we want to query.
    On each document library :
    Library > Libray Settings > Columns > Add column from existing site columns and choose the column created in the previous step.
  3. Put values in the new created column (For each file/directory in the document library)
  4. Create a Content Query Webpart and open its tool pane :
    Check : Show items from the following site and all subsites and choose the subsite that contains the document libraries to query.
    For List Type choose Document Library
    And in Additional Filter we can choose the column previously created and set a value (If managed metadat are used, a suggestions list will appear)
  5. Save the CQWP and publish the page

The CQWP will show all the chosen document librarires content filtred with the column value we chose.

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.