Sometimes the only option you’ve got is to alter things using the object model of SharePoint. In this particular case I wanted to change the RSS-settings for a specific list.
So that’s what this little tip is about – customizing the RSS settings of any SPList object using the SharePoint API.
Today I wanted to change and/or customize the RSS settings for a specific list that exist on my site though the API. I found that this wasn’t as obvious as you’d like it to be, and hence I’m writing it down.
The SPList object has a .EnableSyndication property which you can use to turn on RSS for the list, but there’s no obvious property to access if you want to change the RSS settings itself.
Get it working
On your SPList objects, you’ve got the RootFolder property that contains a collection called "Properties" in which you’ll find all sorts of useful information for the list itself.
In my case I wanted to fetch all the settings related to RSS, and made a simple console application to iterate the items in the Properties collection and ended up with the following:
This is the code to list the properties:
Alrighty, so we have the code to see the properties (or use the SharePoint Manager tool from CodePlex). Now we want to alter those properties. Simple:
In order to accomplish the simple task of reading, changing or setting the properties in regards to RSS settings for your list (or any other property, for that matter) – all you need to do is utilize the RootFolder.Properties collection and access the vti_rss_ properties:
I’d like to shout out a thanks to Andrew Burns for being quick on twitter and pulling an answer out of his sleeve for this.