Inside and Out…

An attempt to understand technology better…

Programming the Windows RSS Platform

Posted by Gaurav Khanna on July 2, 2006

One of the interesting things that has been introduced with Internet Explorer 7 (IE7) is the central repository of RSS feeds that will be maintained on the machine running IE7. This is called as the Common Feed List (CFL) and it can be accessed by any application via the COM based API that is being provided alongside. Infact, I wrote IEFeedManager that leverages this API to manage the CFL and also use it to view the RSS feeds.

In this post, I will explain how you can get started to program for this new RSS platform using the managed world. Note: You will need to have IE7 installed on your machine.

First, you will need to add the reference to the COM API library. Right-click your project->Add Reference.. and select the COM tab. You will see Microsoft Feeds listed as shown below:

Microsoft Feeds in the COM tab

Once you add the reference, you will see Microsoft.Feeds.Interop assembly being referenced in your project. Include the namespace with the same name in your project and your are ready to go.

The starting point in the CFL is the FeedManager object. This will allow you to enumerate all the feeds contained in the root folder of CFL, enumerate subfolders and the feeds contained within them. It implements the IFeedManager interface and a typical instantiation will be like this:

private IFeedsManager feedManager = new FeedsManagerClass();

Once you have the IFeedManager instance, you can access the root CFL folder (of the type IFeedFolder) as shown below:

feedRootFolder = (IFeedFolder)feedManager.RootFolder;

Next, you can enumerate the contained subfolders:

IFeedsEnum colSubFolder = (IFeedsEnum)feedRootFolder.Subfolders;

foreach(IFeedFolder feedFolder in colSubFolder)

{ // Do something with “folder” object }

Likewise, the Feeds property of an IFeedFolder can used to access the feeds (of the type IFeed) contained in the folder and work with them:

IFeedsEnum colFeeds = (IFeedsEnum)feedFolder.Feeds;
foreach (IFeed feed in colFeeds)

{ // Do something with the “feed” object }

Now that you have the IFeedFolder object and the contained IFeed objects, you can use a variety of properties and method to work with them. For example, to refresh the feed, invoke the Download method against the IFeed object. To delete a folder and its contained feeds (and subfolders as well), invoke the Delete method against the IFeedFolder object.

You could also set the auto-refresh (of the feed) interval using the Interval property of the feed. Not just that, you can even wire up for a notification against a feed folder or a feed so that if they are modified externally (e.g. another application) or are updated (or deleted), your application can be notified about all such behavior!

Possibilities are endless. The new RSS platform is quite powerful in terms of the APIs it provides to do a variety of tasks. Check the detailed documentation here.

Technorati : , , , ,
Del.icio.us : , , , ,
Buzznet : , , , ,

Advertisements

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

 
%d bloggers like this: