A little while ago I wrote how it was possible to create an XSLT List View Web Part that could be exported. Whilst this is very useful, I actually find myself using a similar technique more often for displaying an XLV for a list on a different site from where has been created.
For example, with just a few lines I can display an XLV of a site from the root of my site collection on a sub-site. (As per my previous post, I’m well aware that this is possible in with SharePoint Designer – but not everybody is in a position where that’s an option!)
<?xml version="1.0" encoding="utf-8" ?>
<webParts>
<webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
<metaData>
<type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<importErrorMessage>Cannot import this Web Part.</importErrorMessage>
</metaData>
<data>
<properties>
<property name="Title" type="string">My Web Part</property>
<property name="ListName" type="string">B8381C7D-3B8D-46D8-8E40-C96E1FF4C308</property>
<property name="ListId" type="string">B8381C7D-3B8D-46D8-8E40-C96E1FF4C308</property>
<property name="WebId" type="System.Guid, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">adea17f7-e661-4ff0-91e9-70f021c60647</property>
<property name="ExportMode" type="exportmode">All</property>
</properties>
</data>
</webPart>
</webParts>
The main differences here from displaying a list on the current site is adding in the properties for WebId and (bizarrely) ListName withGUIDs and replacing ListUrl with ListId.
With the above code it’s then simply a case of:
- Update the sample GUIDs in the above code (after locating the correct web and list IDs)
- Save as a .webpart file
- Edit a page and upload the web part
- Add the web part to the page; modifying the properties as desired









[...] 05/07/11: After regularly using the technique, I’ve finally written up a post on how this can be done for a list from a different [...]
This worked great for me with one execption. Im placing my web part on a page with a document library next to it. When a user clicks a folder from the library snd the page does a post back I get the following error:
The object specified does not belong to a list.
This only happens on a page where I’ve placed a list web part from a different site. I’m trying to work through the issue but if anyone has any insight it would be appreciated.
[...] of bugs with the XSLT List View Web Part I received a comment on a previous post regarding using the XLV with a list from a different site. The commenter (thanks Roy!) was reporting an issue when viewing a document library from one site [...]
Tis Works great, but do you have any Idea how to get the ListTitleViewSelectorMenu (i.e the View Selector) to work on the new page?