On the downside however, much of this greatness seems locked into SharePoint Designer 2010 though, which doesn’t seem fair! Actually,
it is fair as one of the benefits of the behind-the-scenes changes to the list views is that you now have a very powerful and easy to use tool with which to customise your presentation. This is a big step forward in end-user empowerment and overall a really positive step in my view.
[That said, the whole SPD
should you or shouldn't you debate is valid - and one that I'm not going to get into here. If you'd like further reading then I'd suggest checking our Kerri Abraham's article on NBSP:
SPD SharePoint Emancipation]
So, what about those people who want to do some cool stuff with the XLV web part but yet are in a locked down environment and do not have access to SharePoint Designer? Well it is possible to make really quick changes without SPD at all. The first thing you need to be able to do though is ‘get hold’ of a XLV that you can begin to edit. Exporting the web part is the answer here… but hold on – you can’t export a XSL list view web part.
As you can see in the above screenshot the ability to export an XLV has been disabled by default – but that is something that you can pretty easily turn back on. Admittedly at some point here SPD has was used for the following technique – but once it’s been used (i.e. once only by me) there’s no reason that you’ll ever need it to use it again once you have the following few lines of mark-up (i.e. you don’t need it!).
So, my approach involved opening up a page with an XLV in SPD and saving the web part file locally. I then simply edited the resulting file in notepad until it looked like the below code:
01 | <? xml version = "1.0" encoding = "utf-8" ?> |
05 | < type name = "Microsoft.SharePoint.WebPartPages.XsltListViewWebPart, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> |
06 | < importErrorMessage >Cannot import this Web Part.</ importErrorMessage > |
10 | < property name = "ListUrl" type = "string" >Lists/CustomList</ property > |
11 | < property name = "ExportMode" type = "exportmode" >All</ property > |
With this code I can carry out the following steps to give me an XLV that can be exported:
- Modify the ListUrl property to the site relative url of my list
E.g. note here that in my example it is lists/customlist not /subsite/lists/customlist
- Save the file locally with an appropriate filename and the extension .webpart
- Edit a page on the same site* as the list and upload this web part
- Add the web part to the page – and note the option to export is now available!
- You should now be able to edit this web part just like any other XLV, e.g. modifying the view etc.
Now that we have the ability to export an XLV it is the first step in opening up some of those great features that are available in SPD for those situations where it’s simply not possible to use SPD itself. In my next couple of posts I’ll hopefully show you a couple of simple changes that you can make to start to make the most of the export option.
*As a final thought, this works for an XLV on the same site as the list you want to show – but what about if you wanted to show a list from a different site? Well, I think in this case you could replace the ListUrl property with the ListId and the WebId properties and that may work for you. When I get a moment I’ll confirm this.
Update 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 site.
Update 06/04/11: If you’re interested in possible uses of this I’ve added a post on
changing the default message displayed when there are no items in an XSLT list view web part that relies upon this export technique.
Comments