in

Platinum Bay

Peace, Love and Visual Studio Team System

.NETicated

CS Blogroll Publisher

I use Outlook 2007 as my feed reader. I have Outlook open all the time anyway in the Unread Mail folder, so this allows me to get blog posts along with email. I also want to have my blogroll on my blog and not have to maintain it in two places. There was not built-in mechanism in CS to do this, so I have built and released my first Community Server related tool to solve this problem.

Let's start at the top. Microsoft installs some nifty RSS stuff with IE7 called the Windows RSS Platform. You can find more info here and on Google. There is even an API screensaver sample in the Microsoft Download Center.

The Windows RSS Platform is what stores the feeds that Outlook shows me. With the API, it's very easy to get a list of feeds, etc.

The first step is to add a COM reference to Microsoft Feeds 1.0.

Then it is a simple matter of using the API. Below is sample Console code to retrieve the feeds on your system.

Imports Microsoft.Feeds.Interop

Module Module1
   
Sub Main()
       
Dim mgr As New FeedsManager
       
Dim root As IFeedFolder = CType(mgr.RootFolder, IFeedFolder)

       
For Each feed As IFeed In CType(root.Feeds, IFeedsEnum)
           
Console.WriteLine(feed.Url & " (" & feed.Path & ")")
       
Next

       
Console.WriteLine()
       
Console.WriteLine("Press any key to exit.")
       
Console.ReadKey()
   
End Sub
End Module

This should be pretty self explanatory. Check out MSDN for more properties available from the IFeed interface, such as the publication date and the last download time.

The next step proved to be a little harder. There is no remote Link service available within Community Server. So I built one called the Blogroll Service and modeled it after the existing BlogService web service. The Blogroll Service imports from two CS namespaces, CommunityServer.Components and CommunityServer.Blogs.Components and inherits from the CSWebServiceBase class. The cool thing about the base class is that it takes care of all the authentication and login stuff.

The other thing that was a little annoying is that the Links type does not provide the classes I would hope to find in a collection, such as FindByName or FindByUrl. It took a bunch of reflectoring to finally nail down how the pieces, CategoryId, SectionId and whatnot all fit together.

I ended up with an AddOrUpdateFeeds class.

<SoapHeader("Credentials"), WebMethod(Description:="Adds and updates the feeds on the blogroll.", EnableSession:=False)> _
Public Function AddOrUpdateFeeds(ByVal listName As String, ByVal feeds() As Feed) As Integer
   
MyBase.LoginSetSection()

   
Dim linkCategoryId As Integer = GetLinkCategory(listName)

   
' kind of a hack, but will do for now
   
' need to get some changes into the CS API to allow for better link mgmt
   
For Each item As Link In Links.GetLinks(linkCategoryId)
       
Links.DeleteLink(item.LinkID, item.LinkCategoryID)
   
Next

   
For Each feed As Feed In feeds
       
Dim link1 As Link = Me.GetLink(feed.Title, linkCategoryId)

        link1.LinkCategoryID = linkCategoryId
       
link1.IsEnabled = True
       
link1.Title = feed.Title
       
link1.Url = feed.URL
       
link1.IsEnabled = True
       
link1.Description = String.Empty
       
link1.Rel = String.Empty

       
If (link1.LinkID > 0) Then
           
Links.UpdateLink(link1)
       
Else
           
Links.CreateLink(link1)
       
End If
   
Next
End Function

Rather than write all the code to handle delete detection, I just deleted all the links from the list, and added the supplied ones. It's a hack, and not pretty, but it's 1.0 and serves my purpose.

To use the program, first choose Tools >> Options, and enter your information.

Then click Upload feeds.

There are a couple of things I'd like to add into future versions:

  • The ability to deselect feeds from the list being published.
  • Delete detection
  • Maybe build it as an Outlook 2007 add-in to monitor the Feeds API events and update in real time. Maybe would be better as a tray app or a windows service?
  • Make it faster, the web service seems to take awhile to load in the new links.
  • Get the actual blog URL instead of using the RSS url.

The binary and source bits can be had in the download section.

Comments

May 11, 2007 2:17 PM

This looks like a great tool.  Thanks so much for contributing it for everyone to enjoy.

 

May 15, 2007 7:23 AM

blog bits The CarKnee has been on a tear this week. He released three CS2007 controls, a control to add

 

May 15, 2007 7:51 AM

Steve Andrews releases the source and binaries of an interesting app he wrote to upload outlook feeds

 

Leave a Comment

(required )  
(optional )
(required )  
Add

About Steve

Steve Andrews has been working as a developer for more than 8 years. During this time, he has designed and developed applications in such widely varying areas as trust accounting, medical information management, supply chain management, and retail systems. He has firsthand developer experience with a variety of languages, including Java, VB, and .NET. Most recently, he has been immersed in SharePoint. He is currently employed at RDA Corporation in Philadelphia, PA, as a Software Engineer and a team member in the Architectural Guidance evangelism team. Steve is also an MTCS (x2), ICSOO, and .NET fanatic.
Powered by Community Server (Commercial Edition), by Telligent Systems
© Platinum Bay | Some Rights Reserved Creative Commons License

Disclaimer: The information in this weblog is provided "AS IS" with no warranties, and confers no rights. This weblog does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion. Feel free to challenge me, disagree with me, or tell me I'm completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or annonymous comments) - so keep it polite, please.