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.
There are a couple of hoops I had to jump through to get this to work.
First, make sure you are a sharepoint admin with full control of your site collection.
If you don't have Sharepoint Designer, download it here. You'll also need the SharePoint Online Management Shell which you can download here or install in Powershell.
Step by Step…
Actions in Powershell
- These instructions will tell you how to install the Sharepoint Online Management Shell and connect to your Sharepoint Site.
- To enable the scripting feature in Sharepoint Designer, from a Sharepoint Online Management Shell window type: Run Set-SPOsite -DenyAddAndCustomizePages 0.
For more details, please refer here and here.
Actions in the source site collection…
Open your source site (the site containing the document library in question) in SharePoint Designer:
- Go to your source site online and click Page on the ribbon
- Click the little down arrow under Edit Page and choose Edit in Sharepoint Designer.
- It will ask if you want to open Sharepoint Designer, say yes.
- It will ask if you want to open the content, say yes.
- Sharepoint Designer may ask you to log in at this point. Sharepoint Designer is from Office 2013 and does not support MultiFactor Authentication (MFA). If you have MFA on your account, you'll need to either turn it off or create an app password when Sharepoint Designer asks you to log in.
Actions in Sharepoint Designer...
- Click on “Site Pages” in the left hand menu
- Click on the small down arrow under the “Page” icon on the top menu ribbon & select ASPX. Give your new file a 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 says…”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. So just click on Save in the far top left hand menu.
- Place the cursor in between the 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 “”. Create a new line or two.
- 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.
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.
- Edit the page
- Go to “Insert”, “Web Part”. Select “Media and Content” from the categories menu. Then select “Page Viewer” from the “Parts” menu. 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.
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 course, 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.
Additional source here.