Microsoft introduces with Vista/IE7/Office2007 the Microsoft RSS Platform - For some reasons my IE is not able to export the feeds that I read in IE7 and Outlook 2007 to OPML.

I had a look at the API and wrote this small console applictaion to export my feed list to the OPML format.


using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Xml;
using Microsoft.Feeds.Interop;
using System.Collections.Generic;
namespace RssWindowsPlatformOpmlExporter
{
    class Program
    {
        static void Main(string[] args)
        {
            string pathToExport = "D:\temp\feeds.opml";
            if (args.Length > 0)
            {
                pathToExport = args[0];
            }
            FeedsManager mgr = new FeedsManager();
            Queue«span style="color: teal;“>IFeedFolder> queue = new Queue«span style="color: teal;>IFeedFolder>();
            queue.Enqueue(mgr.RootFolder as IFeedFolder);
            while (queue.Count > 0)
            {
                IFeedFolder currentFolder = queue.Dequeue();
                IFeedsEnum subFolders = (IFeedsEnum)currentFolder.Subfolders;
                for (int i = 0; i < subFolders.Count; i++)
                {
                    queue.Enqueue((IFeedFolder)subFolders.Item(i));
                }
                using (XmlWriter opml = XmlWriter.Create(pathToExport))
                {
                    opml.WriteStartDocument();
                    opml.WriteStartElement("opml");
                    opml.WriteAttributeString("version", "1.0");
                    IFeedsEnum feeds = (IFeedsEnum)currentFolder.Feeds;
                    for (int i = 0; i < feeds.Count; i++)
                    {
                        IFeed feed = (IFeed)feeds.Item(i);
                        try
                        {
                            if (!string.IsNullOrEmpty(feed.Title)
                                && !string.IsNullOrEmpty(feed.DownloadUrl))
                            {
                                opml.WriteStartElement("outline");
                                opml.WriteAttributeString("title", feed.Title);
                                opml.WriteAttributeString("xmlUrl", feed.url);
                                opml.WriteEndElement();
                            }
                        }
                        catch (COMException e)
                        {
                            Console.WriteLine(
                                "Error getting feed: {0}“,
                                e.Message);
                        }
                    }
                    opml.WriteEndElement();
                    opml.WriteEndDocument();
                }
            }
        }
    }
}