Control the RSS Feed Settings on an SPList via the API

Tobias Zimmergren tweeted today asking

Anyone got recommendations to how you modify RSS-Settings for an SPList object using the API?

Good question. The SPList object does have a property EnableSyndication that gets or sets whether an RSS feed is available. There is also an property ‘AllowRssFeeds’, but it is, apparently, read only.

So, you can set whether one is allowed or not – but there are a lot more settings. What about controlling them programmatically?

I mean, the settings page in SharePoint looks like this:

RSS Settings Page

Where are those settings? Well, looking in SharePoint Manager (fantastic tool) we can see:

RSS in SharePoint Manager

These settings are actually properties on the Root Folder of the SPList (i.e. SPList.RootFolder.Properties). To check this I wrote some code to look through the properties and output them to the console:

Code to output properties

And this output:

Root Folder Properties

So, what are the RSS specific properties (there are plenty of other properties in the RootFolder – email enabled list settings, for example):

  • vti_rss_ChannelTitle (string) – The Name of the Rss feed
  • vti_rss_ChannelImageUrl (url as a string) – the url of the image to use in the RSS feed
  • vti_rss_ChannelDescription (string) – The description of the RSS feed.
  • vti_rss_ItemLimit (int) – the maximum number of items in the feed
  • vti_rss_DayLimit (int) – the maximum number of days to include items for.
  • vti_rss_DocumentAsLink (bool as 0 or 1) – Link Rss Items directly to their files? If 1, the title of the Rss Item links directly to the file
  • vti_rss_DocumentAsEnclosure (bool as 0 or 1) – Include file enclosures for items in the feed? If 1, the Rss Item contains a link to the file.
  • vti_rss_DisplayRssIcon (bool as 0 or 1) – Unknown. Doesn’t seem to do anything
  • vti_rss_DisplayOnQuickLaunch (bool as 0 or 1) – Unknown. Doesn’t seem to do anything.
  • vti_rss_LimitDescriptionLength (bool as 0 or 1) – Truncate multi-line text fields to 256 characters?

So, you can set those values and change your RSS settings. Should all be pretty obvious now. Don’t forget to do RootFolder.Update() when you’ve changed the properties…

EDIT: Tobias blogged about this himself too.

Advertisements
Control the RSS Feed Settings on an SPList via the API

5 thoughts on “Control the RSS Feed Settings on an SPList via the API

  1. Matt says:

    Hi, Thanks for this it was very helpful. However I have found that if the RSS feed for the list has been enabled via the interface, the SPList.EnableSyndication property is then ignored ( or at least become unchangeable). I have tried running with elevated priviledges to no effect. Not sure what to try next. Any suggestions?

    Ta!

    Like

  2. No, I’m pretty sure I did that. It worked for me!

    I would try using SharePoint Manager to look at the actual properties on the list and in the root folder, and check those out.

    Like

  3. PuruNep says:

    hi!
    I am working in Rss Settings to set Programatically, In MOSS it works fine. but in SharePoint Server 2010, I didn’t found vti_rss_… in list.Rootfolder properties.
    How can I access rss settings in SP2010. I have also tried from Sharepoint Manager I didn’t found there.
    Thanks
    PuruNep

    Like

  4. PuruNep says:

    I found the solution : Rss Settings page created only after we clicked on Rss settings. So, “vti_rss_… ” properties on list Rootfolder appears once we clicked on Rss settings link.
    Thanks
    PuruNep

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s