Death by right-click -> Delete ? Nope. PowerShell.

So at one stage I was testing the RSS reader capabilities of Outlook 2007, and I imported an OPML file with roughly 500 feeds! Of course I was NOT interested in reading ALL of them, and it was causing quite a bit of work to do on my machine to fetch them all and sync the content in my mailbox…

So I figured out it was possible to remove the subscription (from the Tools menu -> Account Settings -> RSS Feeds) but the folders were left there. Now, I didn’t want to have those 500 folders in my mailbox, and I did not even want to die by right-clicking, pressing “delete”, confirming…. all of this 500 times! No way.

So I wrote this little PowerShell script, I guess it *might* be helpful to someone at one stage, who knows ?

[System.Reflection.Assembly]::LoadWithPartialName(‘Microsoft.Office.Interop.Outlook’)
$oApp = New-Object -COM ‘Outlook.Application’
$rss = $oApp.GetNamespace(“MAPI”).GetDefaultFolder(“olFolderRssFeeds”)
forach ($folder in $rss.Folders)
{
$folder.Delete()
}

Please note that if you don’t have the Office Interop Assemblies installed on your machine, you can’t use the first line. As a result, you will have to change the third line hardcoding the number that represents the RSSFeeds folder, so it would become:

$rss = $oApp.GetNamespace(“MAPI”).GetDefaultFolder(25)

Note: I found out (later, of course) that there is a much more general post on this subject (that is, automating Outlook through PowerShell): http://www.leeholmes.com/blog/GettingThingsDoneOutlookTaskAutomationWithPowerShell.aspx

Share this on Social networks
TwitterFacebookLinkedInPin ItWhatsApp



On this website we use first or third-party tools that store small files (cookie) on your device. Cookies are normally used to allow the site to run properly (technical cookies), to generate navigation usage reports (statistics cookies) and to suitable advertise our services/products (profiling cookies). We can directly use technical cookies, but you have the right to choose whether or not to enable statistical and profiling cookies. Enabling these cookies, you help us to offer you a better experience. Cookie and Privacy policy