Friday, April 17, 2009

Sorting / Filtering SharePoint RSS feeds

Really, REALLY BIG RSS feed button by photopia / HiMY SYeD on flickr.com Ever wondered if it was possible to sort or filter the automatically generated SharePoint RSS feeds? Well I did and, as a matter of fact, I found a solution. The idea is very simple, you create the view that will filter or sort your list elements according to your needs. You then take the guid of your view and append it to the feed URL.

Et Voila !

Here is an example, let’s say I have a Task List (screenshot from a French MOSS farm, I am sure you’ll get the idea anyway) with some items pending, other finished. This status is defined in a “State” (Etat) column.

image

I first create two views filtering on the Etat column. One returns the pending elements, the other returns the finished elements.

I then take note of the guid of my two views (Editing the views and extracting the &View=….. part of the URL does the trick).

After making sure that RSS feeding is activated for my task list, I can go check the RSS feed at :

http://MyServer/_layouts/listfeed.aspx?List=a4a88bd0%2Ddf29%2D4f54%2Da924%2D195be47346ed

The results as displayed by IE7 looks like :

image

All the items are displayed whatever their status but let’s say that I want to see only the elements pending, so that I know what I need to work on. I just append "&View=<VIEW_GUID>" to the URL and here is the result :

http://MyServer/_layouts/listfeed.aspx?List=a4a88bd0%2Ddf29%2D4f54%2Da924%2D195be47346ed&View=%7B9F3ACEAB%2D75DF%2D4C04%2D83C2%2D3A5733A6CA31%7D

image

By the way, I only tested this on a MOSS 2007 SP1 install. I would be interested to know if it works with WSS as well.

I wonder if this is documented anywhere as I stumbled upon this feature by pure chance ?

RSS picture credit Photopia on flickr

6 comments:

Anonymous said...

Found this when I needed it, thx!

Then I found the RSS icon in the Edit View page, once the view has been created, the icon appears next to the file name field.

You don't need to cut and paste...

Joe said...

You are right, there is indeed a tiny icon. Truth be told, I discovered this icon after writing this article.

Yet this approach is also valid when using Owssvr.dll to retrieve list items.

Anonymous said...

It appears that the RSS sorting function "takes over" the sort that's in the view.

We have a custom list with a view that first sorts by author, then by date submitted. When you click that icon in the edit view page (or follow your steps to copy and paste) the RSS sorting function sorts by Date by default. We have to click Author to have the RSS sort the same way as the view.

I could see problems if you wanted to sort by other fields that are not in the RSS sorting function, for example by a custom column.

Or is there a way to add other/custom list fields to the RSS sorting feature? Or perhaps turn that sorting feature off, so that what you see in the View is exactly what you see in the RSS?

Joe said...

Anonymous,

What RSS feed reader do you use? Maybe it's the reader which is sorting the entries based on the date.

After testing on a MOSS SP2 farm, I can ensure you that it is possible for the RSS feed items to be sorted based on a custom field.

Or I didn't get your comment/problem right ?

Anonymous said...

Thanks Joe, just what I was looking for and just in time before I was getting mad again at SharePoint ;)

Daniel Keegan said...

Good post and well done for finding this out.

I'm intrigued by the ability to tell the Listfeed.aspx a view GUID and it outputs the additional fields e.g. Status or Priority - these aren't standard RSS fields so is it actually including the values in those columns in the rss element?