Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Control Your Feeds with Windows Vista's New RSS Platform : Page 3

By adding OS-level support for RSS in Vista and making that support available to .NET developers, Microsoft has provided an easy way to build completely new classes of applications with little additional effort.


advertisement
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.




Paul Ferrill, based in Chelsea, Alabama, has been writing about computers and software for almost 20 years. He has programmed in more languages than he cares to count, but now leans toward Visual Basic and C#.
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap