Home > SharePoint > Using Content Query WebPart to display Files from a specific folder

Using Content Query WebPart to display Files from a specific folder

Content Query Web Part (CQWP) is a powerful tool to aggregate and display content from different sources. It also allows you to modify the presentation of your content through XSLT transformation to almost any design you like.

In this post I would like to show you how you can display documents/items from a specific folder in your document library.

In my use case I have a document library with two folders “news” and “old”. 
Folder “News” contains two documents “News 1.txt” and “News 2.txt”. Folder “Old” contains also two files “Old 1.txt” and “Old 2.txt”. There is also a file “root document.txt” which is stored directly in the document library.

Our goal is to display only the documents from “news” folder on our portal landing page. At the end of this exercise we should see only “News 1.txt” and “News 2.txt” in the CQWP.

Default view of the document library for this exercise:



Adding CQWP web part to the landing page

First of all we need to place our CQWP on the landing page of our SharePoint site.

  1. Edit your page


  2. Select “Insert” tab from the SharePoint Ribbon


  3. Click on the “Web Part” and add Content Query Web Part

    If you can not find the “Content Query” Webpart in the “Content Rollup” Category make sure that the “SharePoint Server Publishing Infrastructure” feature in site collection features is activated.


    Configuring the query for CQWP

    After we placed the CQWP on our landing page we need to set up the query to display particular content. 

    To set up the query edit the web part and expand the “Query” node in the settings panel. Select the document library where your document are stored. In my case I will use “Shared Documents” library.

    Leave the settings for “List Type” and “Content Type” as they are:


    After clicking “Apply” button you should see all documents and folders from your document library in your CQWP:


    Now you need to setup “Additional Filters” to show only documents from “news” folder.

    Select “URL Path” from the drop down. Set “contains” as condition and “/news/” as value for your filter. (“news” is the name of the folder where our target documents are stored)


    If you can not find “URL Path” in the drop down, make sure that “Content Type” is set to “<All Content Types>”

    Click “OK” or “Apply” and you will see only documents from the “news” folder:


    Categories: SharePoint Tags:
    1. Pawan
      May 22, 2012 at 6:46 am

      Can we do this in MOSS 2007 also? I didn’t found “URL Path” in addtional filters. I have selected in content type

    2. Yadnesh
      February 5, 2013 at 12:17 pm

      to get URL Path you should select “All content type” in content type section.

    3. Navya
      May 30, 2013 at 5:33 pm

      Thanks a lot! I

    4. August 12, 2014 at 8:21 pm

      Very useful article and well explained.
      Thanks a lot.

    1. No trackbacks yet.

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out /  Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out /  Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out /  Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out /  Change )


    Connecting to %s

    %d bloggers like this: