Wednesday, November 01, 2006 3:25 PM bart

Exploring the IE7 RSS platform in C# - Part 1

Introduction

Internet Explorer 7 introduces a unified approach to RSS. More information can be found on the RSS team blog. The good thing about it, is its availability for developers to consume the RSS feeds of the end-user, for example to build a custom RSS aggregator. Applications like the Windows Sidebar in Vista, the Windows Live Mail Desktop client, Outlook 2007 leverage the power of this API to provide multiple views on the same RSS information. In this series of blog posts I'm showing you little snippets to make a jumpstart with the RSS platform. At the end of this series, a nice (maybe geeky) application will bring together all of the pieces, so watch my RSS feed!

Getting started

For this simple demo, create a new C# Console Application in Visual Studio 2005 and add a reference to the COM component Microsoft.Feeds 1.0. This will build the required interop assembly to be used by our application to consume RSS feeds and obtain RSS information. In Program.cs import the Microsoft.Feeds.Interop namespace:

using Microsoft.Feeds.Interop;

Listing the feeds and the feed folders

RSS feeds are organized in a tree-based structure, allowing the end-user to keep things clean by putting feeds in folders and subfolders. Let's visualize this in the console. Here's the code:

void Main(string[] args)
{
   FeedsManager mgr = new FeedsManagerClass();
   IFeedFolder root = (IFeedFolder) mgr.RootFolder;
   GetFeeds(root, 0);
}

static void GetFeeds(IFeedFolder parent, int n)
{
   string spacing = new string(' ', n);
   if (n > 0)
   {
      Console.ForegroundColor = ConsoleColor.Yellow;
      Console.WriteLine(spacing + "\b+" + parent.Name);
      Console.ResetColor();
   }

   foreach (IFeed feed in (IFeedsEnum) parent.Feeds)
      Console.WriteLine(spacing + feed.Name);

   foreach (IFeedFolder folder in (IFeedsEnum) parent.Subfolders)
      GetFeeds(folder, n + 1);
}

Don't forget the required casts to get the thing up and running, due to COM interop stuff. The output should look exactly like your (expanded) IE7 Feeds display in the Favorites Center:

Have fun!

kick it on DotNetKicks.com

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Filed under: ,

Comments

# re: Exploring the IE7 RSS platform in C# - Part 1

Wednesday, November 01, 2006 11:51 PM by Wim De Cleen

Maybe you can use my earlier findings on the Microsoft Feeds API, I did a series about it in february this year, about importing an exporting feed lists. Here are the posts Microsoft Feeds API, a Really Simple Sample Microsoft Feeds API, import and export feed lists Microsoft Feeds API, event handlers Microsoft Feeds API, a Really Simple Sample (PART II) Microsoft Feeds API, a Simple List Extensions (SLE) sample

# TechEd 2006 Developers - Day Four

Thursday, November 09, 2006 8:10 AM by B# .NET Blog

Damn God, what a busy day this was. Yesterday at our Belgian country party, organized together with Luxembourg

# The November 06 Month Report

Friday, December 01, 2006 4:06 AM by B# .NET Blog

Yet another great (well, at least in my opinion) month of Daily Blogging . Once more, feedback from readers

# "Exploring The IE7 RSS Platform In C#" Article Series

Saturday, December 09, 2006 5:08 AM by Tom's MSDN Belux Corner

Bart De Smet explores the IE7 RSS platform using C# in an article series on his blog: Exploring the IE7

# Bart De Smet explores the IE7 RSS platform using C#

Saturday, December 09, 2006 10:59 AM by .Net Adventures

Internet Explorer 7 introduces a unified approach to RSS. The good thing about it, is its availability

# Trois articles sur l'utilisation de la Windows RSS Platform en .NET

Sunday, December 10, 2006 5:15 AM by Christophe Lauer, Blog Edition

Bart de Smet, MVP de son état, publie sur son blog une série de trois articles expliquant comment utiliser

# > MSDN France - Christophe Lauer: Trois articles sur l'utilisation de la Windows RSS Platform en .NET

Sunday, December 10, 2006 7:00 AM by Prog

Bart de Smet, MVP de son état, publie sur son blog une série de trois articles expliquant comment utiliser

# Utilisation de la Windows RSS Platform en .NET

Sunday, December 10, 2006 7:09 AM by Blog::David

Bart vient de mettre en ligne trois articles expliquant comment depuis C# utiliser la Windows RSS Platform.

# > David Tavan: Utilisation de la Windows RSS Platform en .NET

Sunday, December 10, 2006 8:16 AM by Prog

Bart vient de mettre en ligne trois articles expliquant comment depuis C# utiliser la Windows RSS Platform.

# Bart De Smet explores the IE7 RSS platform using C# | devintelligence.com

Pingback from  Bart De Smet explores the IE7 RSS platform using C# | devintelligence.com