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.
There are a couple of ways of doing this. One is to create a SharePoint solution in Visual Studio & pro-grammatically 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 Guides
Five Simple Steps to Actions in the Source Site Collection
Open your source site in SharePoint Designer, (this is the site containing the document library in question). Then click on ‘Site Pages’ located in the left-hand menu, next click on the small down arrow under the ‘Page’ icon (you can find this on the top menu ribbon) and select ASPX.
*Please Note: It is important to give your file a more suitable name.
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 reads; ”This page does not contain any regions that are editable…..” Just click on “Yes”. At this point you will need to save the file in order to activate some of the controls you will need. Simply click on Save in the far top left hand menu.
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). Move the cursor up so that it is above the closing tag of the “</WebPartPages:WebPartZone>”. Create a new line or two, and save the file again to activate the Data View icon
Select “Insert”, click the down arrow under the “Data View” icon at the top menu.
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. Save the file & go back to your SharePoint site.
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.
Select the URL of the page from your browser address bar & save it to a txt doc or copy to clipboard.
Three Simple Steps to Actions in the Destination Site Collection
Go to your destination site collection. (The SC that you want to display the document library) find the page where you want to see the document library, or create a new page and edit the page.
Go to “Insert”, “Web Part”. Select “Media and Content” from the category’s menu. Then select “Page Viewer” from the “Parts” menu and click Add, within the Page Viewer webpart click on “open the tool pane”.
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. Click, OK, save the page & you’re done!
There are other configuration settings you can adjust such as the size & title etc.
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.