Easy method of showing lists & libraries across site collections

Problem

I have a list or a library in a SharePoint site that I want to show as a webpart on my page. Simple..? Yes, if the list or library in in the same site collection, or child site as the page that you want to display it on. Not is the library is in a separate site collection.

Solution

There are a couple of ways of doing this. One is to create a SharePoint solution in Visual Studio & programatically code up a webpart connection to the library that you want as your source & then iterate through the library object writing some code to the page to show file names & other properties etc.

The method I am going to describe below is a quick fix solution to the problem using SharePoint Designer.

Basically, you create an aspx page in the source site collection that is hosting the library you want to reference. You add a list viewer webpart to this page & use that to show the library, (still in the source site collection). Then from your other site collection where you want to show the library you use a Page Viewer webpart to reference the aspx page from the other site collection.

Step by Step…

Actions in the source site collection…

  1. Open your source site in SharePoint Designer, (thats the site containing the document library in question).
  2. Click on “Site Pages” in the left hand menu
  3. Click on the small down arrow under the “Page” icon on the top menu ribon & select ASPX. Give your new file a suitable name.
  4. Click on the name of the file to open it, & then select “Edit File” in the control panel. You should get a warning message that says…”This page does not contain any regions that are editable…..” Just click on “Yes”.
  5. At this point you will need to save the file in order to activate some of the controls you will need. So just click on Save in the far top left hand menu.
  6. Place the cursor in between the <form> element tags, & select “Insert”, “WebPart Zone”. (If the webpart zone icon is greyed out, just save the file again.
  7. Move the cursor up so that it is above the closing tag of the “</WebPartPages:WebPartZone>”. Create a new line or two.
  8. Save the file again to activate the Data View icon
  9. Select “Insert”, click the down arrow under the “Data View” icon at the top menu.
  10. In the list that appears, you should find the name of the document library that you want to view. Select it & the relevant code will be inserted into your code file.
  11. Save the file & go back to your SharePoint site.
  12. Go to “Site Contents” & select “Site Pages”. In the list you will see the ASPX file you have just created. Select it & you should see a page showing your document library with none of the SharePoint menus & page wrappers that you normally see.
  13. Select the URL of the page from your browser address bar & save it to a txt doc or copy to clipboard.

Actions in the destination site collection…

  1. Go to your destination site collection. (The SC that you want to display the document library)
  2. Find the page where you want to see the document library, or create a new page.
  3. Edit the page
  4. Go to “Insert”, “Web Part”. Select “Media and Content” from the categories menu. Then select “Page Viewer” from the “Parts” menu. Click Add.
  5. Within the Page Viewer webpart click on “open the tool pane”
  6. In the settings window check “Web Page” which is the default & then paste in the URL of the source page that you have just created.
  7. Click, OK, save the page & you’re done! there are other configuration settings you can adjust such as the size & title etc.

Conclusion

This method of displaying a document library across site collections, of even entire farms is a simple yet quick & easy, non-coding fix to get around the problem. Of coarse, you should also be asking yourself if the document library should be maintained in the location where you want to use it…?

Don’t forget to assign the correct permissions to the source document library else no one will be able to view it.