If, like me, you use the RSS feeds feature in Microsoft Outlook 2007 to download podcasts, then you probably find that your .pst file grows very big, very quickly. I wrote a short macro to automatically save all the attachments from an RSS feed to a specified folder.
Open the Visual Basic Editor in Outlook (Alt+F11), create a new module and insert the following code snippet:
Private Const path As String = "[path to folder]"
Private Const feedName As String = ".NET Rocks!"
Private Sub SaveAttachments()
Dim ns As Outlook.Namespace
Dim feeds As Folder
Dim feed As Folder
On Error Resume Next
Set ns = Application.GetNamespace("MAPI")
Set feeds = ns.GetDefaultFolder(olFolderRssFeeds)
Set feed = feeds.Folders(feedName)
Dim item As PostItem
For Each item In feed.Items
If (item.Attachments.Count > 0) Then
Dim att As Attachment
For Each att In item.Attachments
Dim fileName As String
fileName = path & att.fileName
att.SaveAsFile fileName
Next
Dim i As Integer
Dim attCount As Integer
attCount = item.Attachments.Count
item.Display
For i = attCount To 1 Step -1
item.Attachments(i).Delete
Next
item.Close(olSave)
End If
Next
End Sub
One thing that is a little frustrating is that in order to remove the attachments from each RSS item, you have to open each item, remove each attachment and then save the item. When running the macro, this can cause a bit of flickering, which is a minor annoyance but a small price to pay for the time it saves.