We’ve been getting a few questions on how to use RSS Platform events in VB.NET. The problem faced by most inquiries was the fact that the interface returned by the GetWatcher() method call couldn’t be cast to the FeedFolderWatcher or FeedWatcher type. Instead the returned interface can be cast to IFeedFolderEvents_Event or IFeedEvents_Event interface. As done here:

Imports Microsoft.Feeds.Interop

Module Module1

Dim WithEvents watcher As IFeedFolderEvents_Event

Sub Main()

Dim fm As IFeedsManager = New FeedsManager()

Dim rootFolder As IFeedFolder = fm.RootFolder


AddHandler watcher.FeedDownloading, AddressOf watcher_Downloading

End Sub

Sub watcher_Downloading(ByVal path As String)

Console.WriteLine("Downloading {0}", path)

End Sub

Sub watcher_DownloadCompleted(ByVal path As String, ByVal err As FEEDS_DOWNLOAD_ERROR) Handles watcher.FeedDownloadCompleted

Console.WriteLine("Downloaded {0}", path)

End Sub

End Module


The key is the highlighted part.

Note: We are aware that the IFeedFolderEvents_Event and IFeedEvents_Event interfaces do not appear in the Object Browser or in IntelliSense. We are looking into it.

Keep the feedback coming!

-Walter vonKoch