Ways to Display Multiple Document Libraries

It seems that one of the most commonly asked questions on discussion boards and forums is “How can I display documents from multiple document libraries all in one list?”  So, I decided to enumerate some of the available options to achieve this goal.  They each have their pluses and drawbacks.

Relevant Documents Web Part

This web part can be used to display documents that are relevant to the current logged in user.  This applies to documents from all document libraries in the current site.
Its options are:

  • Include documents last modified by be
  • Include documents created by me
  • Include documents checked out to me

There is also an option to display a link to the document library that each of these files exists in, and an option to set the maximum number of items to be shown.  These documents will always be displayed with the most recent ones first.

The drawback to this web part is that it only displays documents relevant to the current logged in user.

Content Query Web Part

This web part will let you display documents from the whole site or site collection.  Publishing features need to be turned on for this web part to show in your list of web parts to be added to the page. 

In the web part toolpane, expand the Query section.  In the List Type drop-down box, choose “Document Library”.  Then, there are other options such as filtering.   The Presentation section lets you set up options for sorting, grouping, and styles.

The drawback to this web part is that, by default, it will only display the Title field of the document libraries.  If the title field is not filled out for documents, then it will display the full document name (with extension included), such as Newsletter.pdf

Unfortunately, there is no option to set up grouping by document library name.  You can group items by content type, though.  So, for each document library, set up a content type just for that library, and delete the default one.  This way, all items uploaded to that library will be associated with that content type, and when items are displayed as grouped by content type in the Content Query Web Part, this will reflect groupings by document library.

Heather Solomon has a great blog about modifying the Content Query web part.  She shows how to not only modify the fields that are displayed, but the styles also.


Linked Source in SharePoint Designer

This method is a little more advanced, since it entails using SharePoint Designer.  This allows you to select specific document libraries on your site, and display the items all together, as one single list.  For this to work correctly, all of your the document libraries that you would like to display together need to have identical columns as each other.  So, if you’ve added any custom columns to one library, then they need to exist on all of the libraries for this to work.

Open the page in SharePoint Designer.  Click on “Click here to insert a Web Part”.  This is really just to make sure that you insert this web part into a web part zone, and not some random spot on the page.  On the <Data View> menu, choose Insert Data View…

1. In the Data Source Library pane, click “Create a new linked source
2. Click the Configure Linked Source button
3. In the SharePoint Libraries section on the left, click to add each of your document libraries.
4.  Click Next
5.  Leave the default option to “merge the contents…”
6.  Click Finish
7.  On the General tab, you can type a name for this new data source.  If you leave it blank, this data source will be called “New Data Source”.  It can be changed at any time.
8.  Click OK.
9.  Click the drop-down box on your new data source, and click “Show Data“.
10. Choose the fields that you would like to be displayed, such as Created, Created By, Name, and Path.
11. Click “Insert Selected Fields As…” and choose Multiple Item View.
12. Ew.  Now the Created By columns looks all messy.  Click on the data in one of the cells in this column. Click the little chevron next to it.  Format as =Label.
13. Now you’ll probably want the name of the document to be a link to the document itself.  Click the chevron on a file name, and Format as= Hyperlink. Click YES to any notification message. 
Address (do this first): /{@FileDirRef}/{@FileLeafRef}
Text to display: {@FileLeafRef}

13. The Path column will show the site/library name that the document is in.  If you’d like to change this to a link to that library, click the chevron on that field, and Format as = hyperlink.  Click YES to any notification message. 
Address: /{@FileDirRef}
Text to display: {@FileDirRef}

14. Save the page.


Now all of the libraries that you selected will show as one big list.  This data view web part also has other options for sorting, filtering, and much more.  This is much better than the content query web part in that you can customize which columns are displayed.  Unfortunately, it’s something that you wouldn’t want general users doing, because we don’t want everyone editing in SPD.

This entry was posted in Uncategorized. Bookmark the permalink.

17 Responses to Ways to Display Multiple Document Libraries

  1. Greg O. says:

    Very useful article – thanks for taking the time to write it! Great blog, by the way.

  2. Hi Laura,
    I would like to find a way to automatically append new libraries/lists with a specific content type to a linked data source. How would you go about doing this?

  3. Dave says:


    When I am at step 11, the button is disabled.
    Can you tell me why?

    On another note…
    To make a long story short, I need to link a scanned image of a document to a document library item. The approch above doesn’t quite fit the bill.
    Would you know how?


  4. Rex says:

    Hi Laura!

    Many thanks for this very useful guide!

    I only had a little trouble finding things that you described as this was the first time I used SPD. “Click here to insert a Web Part” for example was a little tricky, though I understand there are other guides for that 😉


  5. Steve says:

    Good article. It solved lot of my questions.

  6. Hey, nice tips. Perhaps I’ll buy a glass of beer to the person from that forum who told me to visit your site 🙂

  7. Nice tip, keep going with your blogs Laura!

    Join —

  8. Pingback: 3 Minute Screencast: Merging SharePoint Document Libraries | End User SharePoint

  9. Nancy says:

    I have a specific question about using a DVWP to access Word documents in a library.

    I used your tips to set up my DVWP and modified the “Name (for use in forms)” field to create a link with which to open the document.

    I am running Office 2007 so when I click this link, the docs open just fine and I am able to edit, save, etc. no problems.

    My users, however, almost all have Office 2003. They all have Contribute perms to the library. When they click the link, the doc opens in Word but there is no capability to save changes. If they edit, their only option is to save changes to a local folder.

    However- if those same users access the “edit in MS Word” option from the edit menu within the doc library itself (or from a traditional list view web part) for that same document, Word opens for them with all the correct edit/save functionality. It’s only when they use the DVWP link that it’s limited. 🙁

    I have to use a DVWP not a traditional list web part in this case. Is there something I am missing? Is it not possible to provide a link from the DVWP that gives the functionality available in the list view?

  10. Laura Rogers says:

    Hi Nancy,
    I have noticed that the DVWP behaves differently depending on how you create it. Try creating a regular list view of your doc library, with the drop-down box included in the view. Then, open that list view in SharePoint designer, and right click on it. Choose “convert to XSLT”. This will convert it to be a DVWP, but will leave in some of the drop-down box functionality.


  11. Phil says:

    Don’t forget that you can use the DVWP in CrossList mode. This will be much more efficient than joining multiple data sources, and will automatically include any new libraries that are setup.

    See http://blogs.msdn.com/sharepointdesigner/archive/2007/04/24/spdatasource-and-rollups-with-the-data-view.aspx

  12. Su says:

    Create a new linked source – Is it available in Sharepoint 2003.

    Because there is no such option available when i open my sharpoint designer 2007

  13. Chris says:

    Excellent lesson. I’m wondering, is it possible to show the content of the document without taking them to the original source? I’m working with a Knowledgebase that I want to live in a private site, but I want to expose articles with an Audience field = ‘public’ on a public site. Do you know if this can be done with this method or another?

  14. Nancy says:

    I want to use the “Relevant Documents” web part but I need to remove the “Properties” column. Can this be done?

  15. Tim Cadieux says:

    Unfortunatly, none of these options takes Security into account.

  16. Laura Rogers says:

    Actually, Tim, they all take security into account. Users are not going to see items that they don’t inherently have access to.


  17. Greg says:

    One might want to ask “Why do I have documents in different document libraries to begin with”. What I have seen is that there is a tendency to build a document library to put our contracts in, a document library to put our user manuals in, etc.

    A little information architecture up front can often point to the use of a single document library with mulitple content types, and also facilitate some taxonomy and meta data work, so that people don’t think of documents by location, but by properties/metadata…

Comments are closed.