Creating an XSLT List View Web Part from a Different Site

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" ?>
    <webPart xmlns="">
            <type name="Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
            <importErrorMessage>Cannot import this Web Part.</importErrorMessage>
                <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=, Culture=neutral, PublicKeyToken=b77a5c561934e089">adea17f7-e661-4ff0-91e9-70f021c60647</property>                                                         
                <property name="ExportMode" type="exportmode">All</property>                                                  

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:

  1. Update the sample GUIDs in the above code (after locating the correct web and list IDs)
  2. Save as a .webpart file
  3. Edit a page and upload the web part
  4. Add the web part to the page; modifying the properties as desired
share and enjoy
  • Print
  • Twitter
  • Digg
  • StumbleUpon
  • Yahoo! Buzz
  • Google Bookmarks
  • Facebook

9 comments to Creating an XSLT List View Web Part from a Different Site

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>