Sharepoint lead is a place where you can read about interesting topics related to sharepoint, and you can also post comments and suggessions.

Friday, July 25, 2014

Cross site list view web part anywhere in site collection


There are times when you want to display list/library from root level site collection or visa-versa to sub-site but stuck because sharepoint don't provide list view web part that can be shown across sub sites. If you are in same site collection, its possible with the trick I am going to share.

Step 1 - Create a page and drop list view web part there

Create a page in the site/web where you got the list/library and drop the list view web part into that page and save the page.

Step 2 - Export lsit view web part

If you try to see the edit menu for the web part and there is a link called "Export" you can directly export and download the web part.

If you can not see "Export" option in the web part menu, you have to do following:
  • Right click on the web part content heading that shows list/library fields and click on inspect element (IE9+, chrome, firefox and other popular browsers)
  • Once you are ready with web part id, you can use following url to export the web part

Step 3 - Set Web ID

  • Switch to powershell and get guid of the web where the list exists. $w = Get-SPWeb -identity url-of-web;w.ID
  • Open exported .webpart file and find WebID property and set value of the guid you get to the value in WebId node in web part file.

Step 4 - Upload it to web part gallery

  • Go to site settings > Galleries > web part galleries
  • click on upload and upload your web part file here and set title, group and description of the web part

Step 5 - Finished

  • Go to anywhere in your site collection and add the web part. It will show you the list view web part that you uploaded in specific group.


I tested this with list/libraries having html as default view and rendering of the list view web part works. There are lots of functions associated with the list/library that can be performed from ribbon that I have not tested. Please make sure you consider that while using this trick.