Friday, July 18, 2008

An RSS feed for a View

One of my clients came across this neat trick while we were figuring out the easiest way to extract an XML representation of some list data. The default URL for the RSS feed on a list is in the format:

http://<ServerName>/<SitePath>/_layouts/listfeed.aspx?List=<guid>

Where <guid> is a unique identifier for the list or library that you are interested in. How do you find this value? Easy – if you access the site settings page for the list, you will see the appropriate value in the web address in your web browser.

Our issue was that this didn't return the set of records that we wanted. The client noticed some other URLs that I was using (based on using the owssvr.dll url protocol) had a View parameter, so he added it to the ListFeed.aspx link – and it worked!

So you can target a specific view in the list to get your RSS feed from. This makes your URL format:


http://<ServerName>/<SitePath>/_layouts/listfeed.aspx?List=<guid>&View=<guid>

Now, to get the unique identifier for the View, just go to the Settings page for the list and click on the name of the View. The web address displayed in your browser will include the View property. Copy and paste the whole address line into Notepad to extract the appropriate value – it's messy trying to do this directly on the browser address line.