As you probably know in Sharepoint it is possible to add standard List view web part on the page which is located on the same site with referenced list or doclib. But what if we need to use List view web part for displaying list from other sub site (not the one where web part is added)? By default it is not possible but after several additional steps it become possible. Here are these steps:
- Create new test page on the site where referenced doclib is located
- Add list view web part for appropriate list and publish the page
- Open page in Sharepoint designer
- Detach page from page layout
- Edit the page and change <ExportControlledProperties> property from False to True
- Save the page in Designer
- Go back to browser and edit the page. Now Export option will be available for List view web part
- Export web part to local file system
- In browser open other sub site where you need to add exported web part
- Open developer tools panel and in Console tab execute the following javascript code for getting id of the current web:
SP.ClientContext.get_current().load(SP.ClientContext.get_current().get_web())
SP.ClientContext.get_current().executeQueryAsync()
SP.ClientContext.get_current().get_web().get_id() - Copy web id from output
- Open exported .webpart file and find <WebId> property. After export it will contain empty guid: 00000000-0000-0000-0000-000000000000
- Replace it with guid copied from developer console and save .webpart file
- Now again in browser go to sub site where you need to add exported web part and edit the page where web part should be added
- Click Insert web part in some web part zone and click Upload web part. Choose modified .webpart file
- After upload again click Insert web part on web part zone and choose web part from Uploaded web parts category
In result you will have OTB List view web part working with list from other sub site.
No comments:
Post a Comment