SPRSS: Using CleanRSS.aspx

Posted on 3/30/2008 @ 5:31 PM in #SharePoint by | Feedback | 5032 views

What is this blogpost about?

It is about a central peice of SPRSS, which is a community project that provides enhanced RSS functionality in SharePoint. More details on SPRSS.
This blogpost presents a short 5 min tutorial on how you can use CleanRSS.aspx.

What does CleanRSS.aspx do?

It does your dishes. Not quite. It pumps out clean manageable RSS out of any SharePoint list. As an example, consider the announcements list.  Below is an image of the out of the box RSS produced:

Now, as a comparison, here is the RSS produced by CleanRSS.aspx --

Note any difference? Well, there are 2 differences -

a) CleanRSS.aspx actually splits out each column as it's own XML element. This minor difference is incredibly valuable, because now you can attach any XSLT stylesheet, and render the above announcements in any way/shape or form you want.

b) See that IsEditable? That is True if the logged in user can edit that particular list item. This lets you create Editable UI .... RIGHT on the rendering surface. w00t!

How do you use CleanRSS.aspx?

The tenet I followed was, keep it damn easy to cook up a URL using CleanRSS.aspx. There are 2 ways to use CleanRSS.aspx:

a) Leverage a View on a list:

   Here are the steps:

  1. On ANY list, ANY view, click on Modify View, and choose the appropriate columns/sort order/filter/whatever you want!! You must include the "Title (linked to edit item)" column.
  2. Then on that list, copy paste the RSS URL as shown below:

  3. Now, change the URL from --


    .. to ..


    The change is shown in red bold.

    Thats it .. test in a browser. This should produce Valid RSS.
  4. Note: Omitting a View .. will make CleanRSS.aspx target the default view.

b) Leverage a list item:

Sometimes, you will want to have 1 list, with a number of common peices of text .. a.k.a. ReusableText functionality in a publishing site .. only this time, across sites and even farms. In order to do so, you can extract RSS with a single item.. without having to create a View for it. How do you do it? Easy.

  1. As before, create a URL that looks like this -

  2. Now, add an additional Query string .. as shown below:
  3. http://moss2007/_layouts/SPRSS/CleanRSS.aspx?List=51511bf8%2Da6ae%2D4a51%2Dbeb4%2Dc23f30309633&Title=Some Random Announcement

  4. Thats it :). Test in a browser, to make sure it works.

Sound off but keep it civil:

Older comments..

On 4/16/2008 12:43:14 PM Rand Williams said ..
This is sweet.

On 6/24/2008 5:17:31 AM Ulrich Bernskov said ..
This is just what I was looking for.

However. I have a problem with the intended use:

If I view the feed with /SPRSS/CleanRSS.aspx using several different RSSviewers and all looks well.

I want to use the XML viewer webpart. And just as you depicted the OOTB feed does not treat additional cloums added to "Annoucements" or other lists as proper elements, but it does render the feed. (Providing the needed ajustment to the security has been set for the list - Either anonymous Read or Kerberous/Worker process)

Now when I try the use the /SPRSS/CleanRSS.aspx in the XML webpart I get the error

"Cannot retrieve the URL specified in the XML Link property. For more assistance, contact your site administrator."

If I feed the same URL into the RSS Webpart I get the "The RSS webpart does not support authenticated feeds." which should indicate that rights were incorrectly set.

But if I use the /listfeed.aspx it renders in XML and RSS WebPart.

Any hints?

On 6/24/2008 5:19:30 AM Ulrich Bernskov said ..
I also tried to use the SPRSS.webpart I found in the Codeplex wsp archive.

When I use that I get this:


Feed not available at this time! Error message:

System.Net.WebException: The remote server returned an error: (401) Unauthorized.

at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)

at System.Net.WebClient.DownloadData(Uri address)

at SPRSS.WebParts.RSSRender.Render(HtmlTextWriter writer)


RSS Url: http://tst2/Editors/EditDemo/_layouts//SPRSS/CleanRSS.aspx?List=451bf463%2D8f2c%2D4932%2D9ffe%2Dc08e3c346cac&View=3d711c04%2D3d09%2D486f%2D82c1%2D51512500402a


On 6/24/2008 8:15:33 AM Sahil Malik said ..
The second error is regarding the webpart not being able to access the feed. Is the URL ok? Is network connectivity ok? Are you using FBA?

On 6/24/2008 8:33:37 AM Ulrich Bernskov said ..
Unfortunatly I cannot post screenshots, but yes I am very sure the URL is formatted correctly.

When I use the OOTB RSS link with /listfeed.aspx then I get the result rendered in any RSS reader, but have the limitations of coloumsn not being treated as <elements>

When I enter /SPRSS/CleanRSS.aspx it works when I press the "Test link" and see the result in IE, but the feed does not work in either XML nor RSS viewer webpart.

Not even the SPRSS.webpart will render and spews the above error.

On 6/24/2008 8:34:01 AM Ulrich Bernskov said ..
I do not know what FBA refers to?

On 6/24/2008 10:07:13 AM Ulrich Bernskov said ..
if FBA is From Based Authentication then no. I use Kerberos and have given anonymous read access to lists and read access to this specific lsit. As stated before. The OOTB /listfeed.aspx feed renders /SPRSS/CleanRSS.aspx does not.

It appears that the /SPRSS versions gives med this:

<item><title>test2</title><link>Lists/Announcements/DispForm.aspx?ID=12</link><description><Attachments>True</Attachments><Modified>24/06/2008 16:37</Modified><IsEditable>False</IsEditable></description></item>

whereas the original /listfeed.aspx gives me this:

<item><title>test2</title><link>http://tst2/Editors/EditDemo/Lists/Announcements/DispForm.aspx?ID=12</link><description><div><b>Body:</b>; <div class=ExternalClassE1DE47F7B24D4FCA985B9C8159C71F7E>



<p><font size=2>Quisque vitae justo eu velit feugiat tincidunt. Proin non risus. Nunc porta. Sed est dui, cursus at, egestas a, semper non, sapien. Pellentesque pede nisi, dapibus ut,...</div>

<div><b>Attachments:</b> <a href="http://tst2/Editors/EditDemo/Lists/Announcements/Attachments/12/5s2work.jpg">http://tst2/Editors/EditDemo/Lists/Announcements/Attachments/12/5s2work.jpg</a><br><a href=""></a></div>

</description><author>Ulrich Bernskov</author><pubDate>Mon, 23 Jun 2008 08:02:49 GMT</pubDate><guid isPermaLink="true">http://tst2/Editors/EditDemo/Lists/Announcements/DispForm.aspx?ID=12</guid></item>;

On 6/24/2008 1:05:42 PM Ulrich Bernskov said ..
If I add the code from http://blah.winsmarts.com/2007-10-CQWP_Frustrations_-_Introducing_CARBURETUR.aspx

to the XML web part in XML Editor and add the /SPRSS/CleanRSS.aspx feed and do not use any XSL I get the following result:

using System; using System.Runtime.InteropServices; using System.Web.UI; using System.Web.UI.WebControls.WebParts; using System.Xml; using System.Xml.Serialization; using Microsoft.SharePoint; using Microsoft.SharePoint.WebControls; using Microsoft.SharePoint.WebPartPages; using System.Xml.Xsl; using System.IO; using System.Reflection; using System.Xml.XPath; namespace RSSRender { [Guid("ab18a8de-2765-4c1e-b99a-82f93a27f667")] public class RSSRender : System.Web.UI.WebControls.WebParts.WebPart { private string rssUrl; private string xslTransform; [WebBrowsable(true)] [Personalizable(true)] public string XSLTransform { get { return xslTransform; } set { xslTransform = value; } } [WebBrowsable(true)] [Personalizable(true)] public string RssUrl { get { return rssUrl; } set { rssUrl = value; } } public RSSRender() { this.ExportMode = WebPartExportMode.All; TextReader ootbXSLTStream = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("RSSRender.OOTBXSLT.xml")); xslTransform = ootbXSLTStream.ReadToEnd(); } protected override void Render(HtmlTextWriter writer) { XmlDocument rssDoc = new XmlDocument(); try { System.Net.WebClient wc = new System.Net.WebClient(); wc.Credentials = System.Net.CredentialCache.DefaultCredentials; byte[] rssBytes = wc.DownloadData(rssUrl); string rssText = System.Text.ASCIIEncoding.ASCII.GetString(rssBytes, 3, rssBytes.Length - 3); rssDoc.LoadXml(rssText); } catch (Exception ex) { writer.Write("Feed not available at this time! Error message:

" + ex.ToString() + "

"); writer.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name); } XmlDocument xsltDoc = new XmlDocument(); xsltDoc.LoadXml(xslTransform); writer.Write(Transform(rssDoc, xsltDoc)); } private static string Transform(IXPathNavigable input, IXPathNavigable xslt) { XslCompiledTransform xsltProcessor = new XslCompiledTransform(); xsltProcessor.Load(xslt); Stream results = new MemoryStream(); if (input is XmlDocument) { xsltProcessor.Transform(input, null, results); } results.Position = 0; StreamReader rdr = new StreamReader(results); return rdr.ReadToEnd(); } } }

If I add any XSL I get this: Failed to apply XSLT to the content.


On 6/24/2008 1:26:29 PM Sahil Malik said ..
Ulrich - unfortunately, this is just something I'd have to look more closely :(

On 6/24/2008 3:34:10 PM Ulrich Bernskov said ..
Appreciated. The ability to feed any coloum as <element> is high on my list :-)

On 9/14/2008 11:43:40 AM Ulrich Bernskov said ..
Any progress?

On 12/8/2008 9:12:06 AM Kevin Devereaux said ..
How do you make the feed editable on a page? Is there a different webpart you use to render it?

On 6/14/2009 7:36:45 PM Charles Ashford said ..
I'm getting this error. Are you still working on SPRSS? Haven't seen any posts in a while. Thanks.

<pre>System.ArgumentException: Value does not fall within the expected range. at Microsoft.SharePoint.SPFieldCollection.GetField(String strName, Boolean bThrowException) at Microsoft.SharePoint.SPListItem.GetValue(String strName, Boolean bThrowException) at Microsoft.SharePoint.SPListItem.GetValue(String strName) at Microsoft.SharePoint.SPListItem.get_Item(String fieldName) at ASP._layouts_sprss_cleanrss_aspx.GetRSSFromListView(String strListGUID, String strViewGUID, String strTitle) in c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\SPRSS\CleanRSS.aspx:line 74 at ASP._layouts_sprss_cleanrss_aspx.Page_Load() in c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\SPRSS\CleanRSS.aspx:line 13</pre>

On 6/15/2009 12:13:11 AM Sahil Malik said ..

Yeah you need to include the title column in the view you are trying to read.


On 9/8/2009 7:23:32 AM Sridhar said ..
Hi Sahil, Can I pass multiple RSS Feed URLs (more than one list) to "RSS Feed URL" property?

Please let me know. Thank you.

On 1/13/2010 9:09:07 AM Anis said ..

excellent web part - however one problem which I hope you can help with.

The web part doesn't display the RSS Feed when using a domain name (i.e http://anis.mydomain.net/...), however it does work when I use the actual server name (http://myservername/...)

Any advice on how to get it to work with the domain (alternate mapping)?

I'm using WSS 3.0 btw.

On 1/26/2010 5:02:25 AM Anis said ..
Hi Sahil

i've managed to fix the problem I had above, however I now have one last question.

I can't seem to use multiple RSS feeds - I REALLY want to use your web part because it's just a great web part but I need to be able to use multiple feeds - how can I do this?

I thought the web part already allowed you to add multiple feeds but keeps on throwing errors when adding multiple feeds in the feed list. It works perfectly fine with one feed url.

Please help. I'll be extremely grateful for your attention on this one. :)

On 1/26/2010 10:38:03 AM Sahil Malik said ..
Anis -

It doesn't do multiple feeds. I was going to enhance it to do that, but never got the time to do so. if you do it, do you mind doing it on the codeplex version, so I can add you as a developer there?



On 1/27/2010 3:51:57 AM Anis said ..
Hi Sahil

Thanks for the reply :)

I was hoping for a quick fix really as I'm trying to churn out an Intranet on WSS very quickly - with really sharp deadlines.

If I get some spare time to look into this, then I'll give you a shout - if not then it looks like there will not be a suitable RSS web part that's available.

I know there is a web part by Tim Heuer, and it works but it has a major flaw - the links it renders on the page displays the RSS links using the servername and not the alternate access map - and you can't manipulate the href code. Together with that, you can't customize the way it looks like I can with yours using CSS.

Fortunately, some of your code to render the link was in the CleanRSS.aspx file which I was able to quickly manipulate but I'm guessing the work to allow multiple feeds need to be done in Visual Studio? I'm not very proficient at VS and we don't have a license for it either.

If your web part allowed multiple rss then it would be the ONLY complete solution with great customization for WSS and MOSS.

I'm hoping you can re-ignite the enthusiasm to look into this one little matter and complete this very popular web part to be a full and great solution.

Kind regards