Working with the Common Feed Store in Windows

I have been trying to find a way to write an addin or utility to make the RSS support in Outlook suck a little less.  Outlook has support for OPML import, but it flattens the hierarchy in the OMPL file.  For instance, here’s a very small sample of my OPML. 

 <?xml version="1.0" encoding="utf-8"?>
<opml version="1.0">
  <head />
    <outline text="SharePoint">
      <outline text="Andrew Connell [MVP MOSS]" xmlUrl="" />
      <outline text="Dan Attis" xmlUrl="" />
      <outline text="" xmlUrl="" />
      <outline text="Jan Tielens' Bloggings" xmlUrl="" />
      <outline text="Jeremy Thake" xmlUrl="" />
      <outline text="Sahil Malik" xmlUrl="" />
      <outline text="Scot Hillier" xmlUrl="" />
      <outline text="Sharepoint BUZZ" xmlUrl="" />
    <outline text="Live Platform and Cloud">
      <outline text="Angus Logan" xmlUrl="" />
      <outline text="Live Mesh" xmlUrl="" />
      <outline text="David Chappell :: Weblog" xmlUrl="" />
      <outline text="Windows Azure" xmlUrl="" />
    <outline text="Silverlight and CLR">
      <outline text="Brad Abrams" xmlUrl="" />
      <outline text="Jason Zander's WebLog" xmlUrl="" />
      <outline text="Jesse Liberty - Silverlight Geek" xmlUrl="" />
      <outline text="Method ~ of ~ failed" xmlUrl="" />
    <outline text="Videos">
      <outline text="Channel 9: The Videos" xmlUrl="" />
      <outline text="Channel 9: Screencasts" xmlUrl="" />

In Outlook, you can import this OPML into Outlook really easily by going to the “File / Import and Export…” menu and importing an OPML file.


Once you choose an OPML file, you get a dialog like this asking which feeds you want to import.


That creates the following structure.


Argh.  OK, you can kind of work around this by creating a new folder and then manually moving the existing folder.  But then that highlights another problem with the RSS in Outlook… when I use subfolders, I can’t see that there are unread items beneath that folder unless I expand each folder.  When I click on the SharePoint node, it would be nice if I could see all the feeds that are children of that folder in the list view, but it doesn’t work like that (for the record, email doesn’t work like that, either… if you have child folders under your Inbox, you don’t see those child folders in the Inbox list view). 


What I came to realize is that I want Outlook to work very differently than how it is currently implemented.  That’s when you either fire up Visual Studio or purchase a product from someone that’s already done the work for you.  Either I need to do a bit of work with VSTO or C++ to write a custom implementation or give up and just buy NewsGator which already does what I am asking.

My buddy Andrew Coates came up with an interesting possible solution:  Use the Common Feed Store.  Since I was programming an Outlook add-in, I quickly put this code together to test the theory.  All I had to do was add a reference to Microsoft.Feeds.Interop (found on the COM tab) and use the following code to programmatically add to the Common Feed Store.

         void ImportOpml()
            //Prompt for OMPL file             
            System.Windows.Forms.OpenFileDialog openDialog = 
                new System.Windows.Forms.OpenFileDialog();
            openDialog.Filter = "OPML files|*.opml";
            openDialog.Title = "Open OPML file";
            if (openDialog.FileName.Length > 0)
                FeedsManager fm = new FeedsManagerClass();
                IFeedFolder folder = (IFeedFolder)fm.RootFolder;

                foreach (var outline in XDocument.Load(openDialog.FileName).Element("opml").Element("body").Elements("outline"))
                    AddRSSFeed(outline, folder);

        private void AddRSSFeed(XElement outline, IFeedFolder folder)
            if(outline.Attributes("xmlUrl").Count() > 0)
                //This is a feed with a URL
                string SName = outline.Attribute("text").Value;
                string SURL = outline.Attribute("xmlUrl").Value;
                IFeed feed = (IFeed)folder.CreateFeed(SName, SURL);
                //This is a folder with only a name
                IFeedFolder childFolder = (IFeedFolder)folder.CreateSubfolder(outline.Attribute("text").Value);
                foreach (var child in outline.Elements("outline"))
                    AddRSSFeed(child, childFolder);

That was scary easy, and the feeds show up in IE8 right away.

The result of the above routine did, in fact, add the feeds to the Common Feed Store, which then shows up in my feeds in IE8.  Then I went into Outlook (Tools / Options / Other / Advanced) and enabled synchronization between the Common Feed Store and Outlook.


What I was hoping for Outlook to honor the folder hierarchy if it used the Common Feed Store synchronization, but alas it still flattens the hierarchy as shown above. 

Since I can’t find a simple solution to make Outlook honor my intended hierarchy, I decided to take another look at using IE for reading RSS feeds. 


Notice that it preserves the hierarchy, which was one of my goals.  I also like the Filter By Category functionality on the right to quickly filter the items on the current page.  The search functionality is also nice, allowing me to go to Scott Guthrie’s blog and enter “MVC” to find references to MVC in the past 10 posts. 

Since I can’t seem to find a way to make Outlook do what I want (oh, I’m sure there’s some way I can programmatically do this in Outlook using C++, but the amount of effort required has far surpassed both my interest level and attention span), it looks like I am going to be using IE as a feed reader for the near future.  I don’t want to use another program like RSS Bandit, I like having the feeds integrated into a program that I constantly use.  Outlook would have been my first choice, but maybe I can get used to IE for this feature.

The Common Feed Store is a really good idea, allowing you to provide a common repository for feeds that multiple applications can utilize.  I like the idea of being able to subscribe to a feed quickly in IE and then have that feed show up in another application.  I really like not having to maintain an OPML file, which I mainly used to export from one program and import to another as I keep searching for just the right feed reader for me.