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.  This article is written about the enterprise version of SharePoint 2007.

Here’s my related article regarding SharePoint 2010

And here’s one I wrote regarding SharePoint 2013 and Office 365

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. image

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.
http://www.heathersolomon.com/blog/articles/customitemstyle.aspx

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.

image

 

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.

 

32 comments

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

  • 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? Stumped, Patrick

  • Hi, 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? thanks, Dave

  • 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 Regards Rex

  • Good article. It solved lot of my questions.

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

  • Nice tip, keep going with your blogs Laura! Join — http://www.sharepointdesigners.net

  • Laura, 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?

  • 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. Laura

  • 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

  • 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

  • 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?

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

  • Unfortunatly, none of these options takes Security into account.

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

  • Laura, How can i make my linked data source that is created on a sub-team-site appear on top level site?

  • Emil, Create the web part, then go to the browser and click the top right corner of the web part and click . Save it to your computer, then go to wheverver else in the site collection you want it to be displayed, and import it on that page.

  • Nice Blog

  • Hello how to build ascrolling marquee in Annoncements list in sharepoint without Insert text to content editor webpart

  • Ali Shahba, I have no idea.

  • I have the documents inside sub folders. while using the Dataview web part, i am only seeing the folders and not the files. How to see only the files.

  • Hey Laura, Good one.. But is it applicable with SharePoint 2010 ? I don’t find “Create a new linked source” option .

  • Venkat, Take a look at this screencast: http://www.endusersharepoint.com/2009/05/13/3-minute-screencast-use-dvwp-to-display-all-files-even-those-stored-in-folders/ Rishi, In SharePoint Designer 2010, click “Data sources” on the left, then you’ll be able to create a new linked source.

  • Hi Laura, A very helpful post. I am using SharePoint 2010 to create Linked Source but I don’t see “drop-down box with “Show Data”.”, so I am unable to choose the fields I want displayed. Do you have an idea how to do that in SPD 2010. Thanks !!

  • Ricky, In SharePoint Designer 2010, click “Data sources” on the left, and then click “linked source” on the ribbon.

  • Awesome post. Thanks for taking the time to write this, it’s definitely very useful

  • Thanks for the informative article, however, i am trying to something a little more advanced and I’m wondering if you might be able to provide any suggestions. I have a long list that i want to group and then display in several columns. Currently, one of my columns is much longer than the others, i’m trying to figure out how to control how many groups (or items) get displayed in each column, i.e, if i have 100 items in 12 groups, i’d like to have 4 groups in each of the 3 columns

  • Dean, This is the only way to accomplish something similar to your request: Create a new data view web part (not XSLT list view), and in the Style section in SPD, choose the one with 2 columns.

  • There is an even more advanced version of this webpart available. It uses ddwrt to display the IM state of the user and limits the folername to the parent folder:
    http://www.fiechter.eu/blog/Lists/Posts/Post.aspx?ID=19&mobile=0

  • Thanks…Really nice!!!!

  • Great Blog,looking for some more beautiful stuff from you.
    Thanks once again…….
    Hi laura can i have ur skype id , mine is rohit.dhiman450

    I have some doubts regarding some topics, can you help me in solving them please!!!!

  • Thanks for the compliments!

Leave a Reply