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:
Where are those settings? Well, looking in SharePoint Manager (fantastic tool) we can see:
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:
And this output:
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.