devxlogo

Control Your Feeds with Windows Vista’s New RSS Platform

Control Your Feeds with Windows Vista’s New RSS Platform

eally Simple Syndication (RSS) is a set of XML schema that define how providers can publish information destined for consumers. In its most common form, RSS holds the text and pictures you find on someone’s blog, but RSS can just as easily contain news headlines or multimedia files attached to a description. As the name implies, RSS is a simple set of standardized XML tags.

Unfortunately, RSS isn’t all that “standardized.” The term really covers a group of formats that have developed over time. The two most common formats are RSS 2.0 and Atom 0.3. But the good news for developers is that Microsoft’s new RSS support in Windows Vista handles not only these (and earlier versions of the RSS spec), but looking forward, Microsoft has promised support for Atom 1.0 when it is released. The bottom line is that Vista developers don’t have to worry about RSS formats?the Vista RSS API takes care of that for you transparently.

Windows Vista adds RSS support at the operating system level, allowing any application direct access to a common application programming interface (API) for reading and manipulating RSS feeds. Making RSS a first-class citizen of the operating system also gives applications direct access to other functionality, such as the Background Intelligent Transfer Service (BITS), for downloading.

The Windows RSS Platform API encapsulates three main components: Common Feed List, Feed Synchronization Engine, and Feed Store. Each provides functionality used by other programs, such as Internet Explorer 7 and Microsoft Outlook. While there are overlaps in some of the capabilities, the idea is to try to keep things common where it makes sense?such as your feed subscriptions.

Here’s what the Windows RSS Platform provides for developers (from the IE team blog):

  • Support for every major RSS and Atom format, as well as many popular extensions.
  • Background scheduled updates.
  • Support for server-friendly technologies such as conditional GETs and RFC 3229 for feeds.
  • Bandwidth-friendly enclosure downloads using BITS.
  • API exposing a simple object model for feeds as well as direct access to the raw XML stream.

Information on the Windows RSS Platform is still marked preliminary on MSDN. Other good sources of information include the RSS team and IE team blogs.

The RSS Object Model
The FeedsManager object is the top-level entity you deal with to access underlying feeds. If you’ve used any type of RSS reader, you’re probably familiar with the concept of arranging your feeds in groups by some common interest. Many readers, including the one in IE 7, let you create folders to group feeds. The Common Feed List supports the concept of hierarchical folders; each folder can contain feeds or other lower-level folders.

Figure 1. Source, Microsoft: MSDN Object Model for the RSS Platform: The FeedsManager is the top-level object. It has a collection of FeedFolders, each of which can contain feeds or other folders.

Within the folders a Feed object contains a collection of items including feed and channel properties. This approach provides feed information through Feed object properties, but if necessary you can access the raw feed XML and deal with it programmatically instead. The FeedItem object has individual item properties such as a read/unread property along with the actual enclosure. The FeedEnclosure object exposes enclosure properties including the local path where enclosures reside in the file system.

The MSDN documentation depicts the object model as shown in Figure 1.

Getting Started with RSS
Here’s the code for a simple VB.NET program that uses RSS Platform API methods to display all the subscribed feeds from the Common Feeds List in a list box when users click a button:

   Imports Microsoft.Feeds.Interop   Public Class Form1      Private Sub Button1_Click(ByVal sender As System.Object,          ByVal e As System.EventArgs)            Dim root As IFeedFolder         Dim manager As New FeedsManager            root = manager.RootFolder         For Each feed As IFeed In root.Feeds            ListBox1.Items.Add(feed.Name)         Next      End Sub   End Class

Here’s the equivalent version in C#:

Figure 2. Feed Object Properties and Methods: Here’s an Intellisense popup showing the methods and properties for the Feed object.
   using Microsoft.Feeds.Interop;   public class Form1 {       private void Button1_Click(          object sender, System.EventArgs e)       {           IFeedFolder root;           FeedsManager manager = new FeedsManager();           root = manager.RootFolder;           foreach (IFeed feed in root.Feeds) {               ListBox1.Items.Add(feed.Name);           }       }   }
Author’s Note: Special thanks to Microsoft’s Mike Taulty for his help with the code in this article.

The preceding code examples use two RSS API objects: IFeedFolder and FeedManager. These two together provide access to the Common Feed List. The nice part about IFeedFolder is that you can iterate over it to walk through the data. Note the syntax of the For Each loop.

You can use the Intellisense feature of Microsoft Visual Studio to look at the different methods and properties of the feed object. Figure 2 shows a partial list of the methods and properties as shown in the Intellisense popup for the Feed object.

Simple List Extensions
Microsoft announced a contribution to the world of RSS last year to deal with lists of things. They called it Simple List Extensions and released it under the Creative Commons License Attribution?ShareAlike license. That basically means you can do with it whatever you want as long as you attribute it to Microsoft and share your results.

The “Amazon Wish List” is a great example. This is a simple list of items available from Amazon that you’d like to have. Although you can’t directly subscribe to a public list using RSS, there is a way to get there?you just have to sign up for a free subscription ID that lets you access Amazon’s Web services API. After getting your ID, you need only obtain the ListID to which you want to subscribe. With that in hand, it would be pretty simple to (for example) build a birthday gift application for friends and relatives that lets people buy presents for them based on their Amazon Wish List items.

Another great example is eBay auctions. eBay makes it possible to subscribe to any of their auction categories with a simple URL that looks something like this:

   http://rss.api.ebay.com/ws/rssapi?FeedName=StoreItems&      siteId=0&language=en-US&output=RSS20&storeId=61961464

Using an auction category URL, you can build an application that receives new auction items in that category via an RSS feed?without having to directly access the eBay site via your browser. After you’ve subscribed to a feed, the Windows Vista RSS Platform takes care of all the downloading and updating for you.

RSS Events
The RSS Platform API also has an event system built right in. RSS events fall into two basic categories: feed events and folder events. These events fire when a feed or folder is deleted or renamed, or when the feed URL has changed or moved. The platform also raises events when a feed starts or finishes downloading, or when the number of items in the feed changes. Finally, there’s an error event raised whenever any type of feed error occurs.

To use an RSS event to trigger some other action, you simply register an event handler to deal with the event?in the same way you register event handlers to deal with mouse clicks on a button, for example. You don’t have to handle every event; you only need to hook up to events of interest. Using the Common Feed List it’s possible to configure individual feeds to trigger events of interest. You can do that either through code or (in limited ways) by using IE7 to access the feed and set its properties.

To handle most events, you need to add the handler by writing a little code. For example, the following VB.NET code snippet adds a handler named FeedRenamed that fires whenever you rename any feed:

   Dim root As IFeedFolder   Dim manager As New FeedsManager   root = manager.RootFolder   For Each feed As IFeed In root.Feeds      Dim events As IFeedEvents_Event =  _         feed.GetWatcher(FEEDS_EVENTS_SCOPE.FES_ALL, _         FEEDS_EVENTS_MASK.FEM_FEEDEVENTS)      AddHandler events.FeedRenamed, _      AddressOf FeedRenamed   Next

And here’s the equivalent code in C#:

   IFeedFolder root;   FeedsManager manager = new FeedsManager();   root = manager.RootFolder;   foreach (IFeed feed in root.Feeds) {      IFeedEvents_Event events =          feed.GetWatcher(         FEEDS_EVENTS_SCOPE.FES_ALL,          FEEDS_EVENTS_MASK.FEM_FEEDEVENTS);      events.FeedRenamed += new System.EventHandler(         this.FeedRenamed);   }

The preceding examples attach handlers for all feeds. To add a handler for a specific feed you simply change the scope from FES_ALL to FES_SELF_ONLY. The API lets you attach events to folders or feeds or both if you’d like. Earlier, I mentioned that you can also add handlers in limited ways via IE7. Microsoft has a new IE7 add-on called “Feeds Plus” that pops up a notifier in your system tray whenever there are new items to read. Feeds Plus basically attaches an event handler to all (or selected) feeds and pops up the notifier whenever the feed updates.

Ideas for Using RSS
Photo blogs have been suggested as another good candidate for additional coding. You probably don’t want to download every last photo from a particular feed, but you might want to get photos that reference some item or topic of interest. You might also want to grab everything from a particular photographer.

Calendar lists are an obvious good choice for a subscription model. While the iCal and ICS format have the lion’s share of this functionality, there’s still room for another option. Corporate information including management info could make good use of RSS as a distributed model.

RSS was originally envisioned as a way to easily push content from one place to another. Although RSS was first widely used for blogs, it has developed into a much more generic vision. Vista takes RSS to another level with OS-level support, letting you build RSS-enabled applications as easily as you can build Windows Forms programs.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist