.NET (29) Archiving (10) ASP.NET (9) Books (3) C Sharp (30) Code Generation (3) Dasblog (16) Design Patterns (4) Development (37) Exchange (14) Family (10) GPS (7) Hardware (10) mixuk07 (1) Mountaineering (7) MSCRM (6) Office (3) Outlook (13) Personal Development (4) PHP (4) PowerShell (7) Productivity (9) RSS (15) Running (2) Scripting (20) SCRUM (3) Service (3) Software (60) Support (17) TaHoGen (2) Technical (50) Tools (13) Twitter (5) Web (16) Windows 7 (4) Windows Mobile (10) WS* (1)
Sign In
Today, I wanted to configure an Outlook 2007 rule to process RSS items as they are received. By process I mean I wanted to check for attachments/enclosures, if it had any MP3s attached/enclosed then save them to a folder on my desktop (that way I simply sync my Creative Zen Vision: M with the desktop folder and I have all my podcasts available for my commute).
I could not seem to get the Outlook rules engine working correctly on RSS feeds, I wanted to run a script (a function I'd written in Outlook VBA) that was executed every time I receive a RSS item.The 'Run A Script' action in the rules wizard will only list subroutines with a signature like this:
Sub Foo(objItem As MailItem)
Anyway this doesn't work for RSS items as their message class is IPM.Post.RSS (making them a PostItem object). So this is a bit of a pain and means I cannot process RSS items using a rule.In the end I had to use the following code to do it - I just open the folder of the RSS feed and run this (via a custom toolbar button) and it does it all for me.
Public Sub SaveRSSEnclosures() Dim att As Attachment, objList As Object, objItem As Object, iCount As Integer Set objList = Application.ActiveExplorer.CurrentFolder.Items iCount = 0 For Each objItem In objList If (objItem.Attachments.Count > 0) And (objItem.UnRead) Then ' iterate through looking for .mp3's For Each att In objItem.Attachments If LCase(Right(att.FileName, 3)) = "mp3" Then ' save it att.SaveAsFile ("c:\Users\kenh\desktop\podcasts\" & att.FileName) iCount = iCount + 1 End If Next End If Next If iCount > 0 Then MsgBox "Saved " & iCount & " mp3 items" End Sub
Remember Me
a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u