index > Visual Studio Tools for Office > RSS feed in Outlook

RSS feed in Outlook


How can I see if a MailItem is a RSS item using the object model?

// Johan




Regards // Johan
Johan Nordberg
In Outlook 2007? RSS feed items are PostItem with MessageClass = "IPM.Post.Rss" -- not MailItem.
Sue Mosher - Outlook MVP

Thank you!

Yes, I'm using Outlook 2007 and VSTO2005SE.

Is the Application_NewMailEx event the best way to get new RSS items? If so, how can I check what type the

Application.Session.GetItemFromID(entryId, null)

returns? What is the best way to check the type and cast it to PostItem? Now I use Outlook.PostItem post = item as Outlook.PostItem and then check to see if this is null. If not, I check if it's a IPM.Post.Rss.

However, Application_NewMailEx don't seem to fire for new RSS items.

 

 




Regards // Johan
Johan Nordberg

As its name implies, I would expect the NewMailEx event to fire only for new mail. RSS feed items are not mail. You should be able to use the Folder.Items.ItemAdd method to monitor RSS feed folders for new items. What is it that you want to do with these items?

I don't write C# code, so I can't speak to the best way to check the type and cast.

Sue Mosher - Outlook MVP

Thank you. Setting and Item_Add event handler on the DefaultFolder for RSS Subscriptions don't work, so maybe I have to set it for each subfolder? What do you think?

What I hope to achieve is to check for new feeds and check them for padcasts attachment. If the feed is a podcast feed and the item contains an attachment I would like to download it and add it to a playlist in Windows Media Player.

I thought this would be a quite simple project just to learn more about writing addins for Outlook and on the same time something I'd really like to have.

Thank you so much for your help both here and on Outlookcode.com.




Regards // Johan
Johan Nordberg

Yes, of course you need to set up an event handler for each folder you want to monitor.

Your project sounds like a great practical application for playing with the new Outlook 2007 features and VSTO 2005 SE.

Sue Mosher - Outlook MVP

It's actually quite amazing! I've never programmed Outlook before but I managed to get a working prototype of this working in just two hours. (I have programmed alot for Word, Excel and ASP.NET)

Now I just have to get a nice UI to select where mp3-files should be saved and create playlists in WMP.

Is it possible to get the actual rss feed from a folder in some way? It would be nice to only hook up event handlers for feeds that really is a podcast feed and make sure that it downloads enclosures automaticly for just these feeds.




Regards // Johan
Johan Nordberg

Sounds like you're having fun!

I haven't found where Outlook is storing the feed list yet, although I know it's somewhere in the default information store.

However, each feed folder has a hidden message containing information about the feed, which you can access as a StorageItem object. The MessageClass is IPM.Sharing.Binding.In, and the Subject holds the URL for the feed, so with a little VBA prototyping: 

    Set fld = Application.ActiveExplorer.CurrentFolder

    Set si = fld.GetStorage("IPM.Sharing.Binding.In", _

                            olIdentifyByMessageClass)

    If Not si Is Nothing Then

        MsgBox si.Subject

    End If

BTW, if you enjoy this kind of digging, get yourself a copy of Outlook Spy or MFCMAPI.exe.

Sue Mosher - Outlook MVP

Yeah, I'm having great fun. As you saw on my post on Outlook Code I hade to write an addin in VB6 for a client. Going back to VB6 after doing .net since the first beta really sucked. I just had to do something not so 1997 to wash away that awful VB6-smell from my fingers.

I'll look in to Outlook Spy! Thanks for the tip and all your help!

Btw. This is probably super simple, but how do I get hold of the currently selected item? (mailitem, postitem or what ever) Is there something like the Selection-property in Word and Excel?




Regards // Johan
Johan Nordberg
Johan Nordberg wrote:

This is probably super simple, but how do I get hold of the currently selected item? (mailitem, postitem or what ever) Is there something like the Selection-property in Word and Excel?

Depending on what you mean by that, Application.ActiveExplorer.Selection (a collection) or Application.ActiveInspector.CurrentItem.

Sue Mosher - Outlook MVP
reply 10

You can use google to search for other answers

 

More Articles

actionspanecontrol v.s. usercontrol
InfoPath Regular expression and white space
Sending email using Outlook 10.0 Object Library
How to control the cell's datatype of Excel(Using Spreadsheet Exp...
VSTO and OLE Automation
Outlook Addin On Windows 2000 Terminal Server
Possible To Intercept Naming of Worksheet Created From Excel Temp...
Measure the width of a string contained in a label control in VST...
Importing data from Excell
sending e-mail from a SmartTag
Welcome to Bokebb   New Update   Joins the collection  
 

New Articles

Chart Component
Clear data from excelsheet
WORDML xslt does not transform data
Proxy objects -- What were they thinking?
Sheet level protection
Avoiding security alert in Outlook while…
Smart Tag aspect
Large dataset bound to ListObject
Visio 2003 : Save as web page bug
connectivity issues outlook 2003
Use Microsoft.Office.Tools.Word.Bookmark…
Excel 2003 automation: setting an array …
How to use Office commandbar objects in …
AppCheck.cpp...PIACheck.cpp
Rewriting the My.Blogs in C#

Hot Articles

Text in a Form Field?
Grant full trust using setup project
VSTO Installation included in Visual Stu…
problem with Replacement in word documen…
VSTO Data Island question.
XML View and how to change reading pane …
Trouble saving combo box values back an …
Problem using ServerDocument.AddCustomiz…
Drag and Drop with VSTO2
Visual Basic Excel Project
VSTO Question: Are ActionsPanes objects …
create an excel workbook
Display the Content of the Uploaded file…
Add a control to PowerPoint slides
Microsoft Visual Studio Tools for the Mi…

Recommend Articles

How do I make controls moveable in Excel
How do i Hide fields so that they don't …
Can SmartTag recognize a Excel Cell's Fo…
Word is still running after you stop deb…
VSTO EXCEL deployment Issue
Appointment Instance not closing
VSTO and ReportViewer
Can't restore database in hands on lab
Get Reference to the Excel Worksheet fro…
Design Issue in Word VSTO Programming - …
Combo box and Cc field... HELP!!!
VSTO add-in setup error accessing registry
Deploying a Word Solution with an Action…
set_Style throws error in Arabic OS
Seroius error while having combobox into…