Capturing Outlook 2007′s New Mail and Reminder Events

February 3, 2009 | By | 2 Comments

Visual Studio 2008′s Outlook Add-in projects allows you to create add-ins that can customize almost any feature of Ms Outlook. Two useful events that can be captured are ReminderFire and NewMailEx. The first occurs before a reminder of a calendar item is executed. And the second occurs when a new email is received in the Inbox.

Following are the list of namespaces imported to reduce some typing.

The ThisAddIn_Startup event is created automatically with the project and is called before Outlook is launched. In this event the fields _Explorers, _Inspectors and outlookNamspace are initialized. _Explorers will contain the Outlook’s Explorers collection, which are the the windows that display the contents of a folder, like the Inbox. The _Inspectors object will contain the Outlook Inspectors collection. An Inspector is a window that displays the contents of a single item like an email or a calendar appointment. And the outlookNamespace field will reference the Mail namespace.

The ReminderFire event’s only parameter is a Reminder object that can be used to get the details of the reminder, like OriginalReminderDate and NextReminderDate if it’s recurring.

The NewMailEx event has one parameter too. It’s a string containing the ID that can be used to retrieve the email. This could be done by passing the ID to the GetItemFromID method of the Application.Session object and getting a MailItem object. The MailItem object has all the email’s details, some of the available properties are Attachments, Body, BodyFormat, CC and BCC.

 

Download Source Code

 



Related Posts:

Filed in: WinForms | Tags: ,

Comments (2)

Links to this Post

  1. CodeHill » Using the Phidgets LCD With Outlook | February 26, 2009
  2. DotNetShoutout | May 17, 2009

Leave a Reply

Trackback URL | RSS Feed for This Entry