Real-Time Checking of New Messages

  • Thread starter Thread starter JahMic
  • Start date Start date
J

JahMic

I have been charged with writing an Outlook add-in that would check
and possibly change certain messages upon receiving and sending
emails. I pretty familiar with Map, but don't know a lot about
programmable support for outlook itself. So, my questions are:

1. Is this possible? (check and change messages upon receiving and
sending)

2. What would be the best way to go about it? I'm a bit overwhelmed by
the options out there... There are VBA/Ole/COM-ish type of things,
Outlook Extension APIs, Outlook Api, Mapi Api, VS Shared addin, VSTO
type of project? I imagine some of these are different orientations on
essentially the objects, but I would like to not go down the wrong
path.

3. Since prefer a c# approach, (c++ is also nice) I'm thinking of a
VSTO addin. Any problems with this?

4. How do i get a hold of messages as they come in?

Thanks in advance,

J
 
ItemAdd on the Items collection of the Inbox would work unless 16 or more
messages came in at once. Item.Send for individual items or
Application.ItemSend for a general approach to items being sent. Those are
the event handlers to use.

You can also use Application.NewMailEx to get a list of EntryID's for
incoming items.

VSTO can only be used with Outlook 2003 Professional or higher and Outlook
2007 (all SKU's), so what you have to support will determine if you can use
VSTO at all. VSTO is also a real chore to deploy, with the scattered
documentation, many hoops to go through and things to set up and making sure
all the prerequisites are installed.

..NET code in general will have many more requirements for successful
deployment than COM code (the correct framework and PIA's have to be
installed by an admin for one thing).

A shared addin using .NET code should really be shimmed to give it its own
AppDomain, to isolate it from other shared addins. However the shim wizard
currently does not work for Outlook 2007, if you need to support that.

In general, I'd usually recommend if you need to support Outlook 2002 or
2000 that you forget .NET code. It can be done but there are many additional
hoops to go through, such as having to custom modify the Outlook 2002 PIA's
for use with Outlook 2000 (there are no Outlook 2000 PIA's).

Also, .NET code can be significantly slower than pure COM code.

Extended MAPI can only be programmed using C++ or Delphi and is not
supported for .NET code. It has a longer learning curve than any other
method but is of course much faster, since all other Outlook API's are
wrappers for, or access, Extended MAPI under the hood.
 
Trying one more time...

Hi Ken,

Thanks for the excellent sumary of options. I have am pretty
comfortable with Com & Mapi, although I'm more of a c++ guy then a vb
guy. Can you direct me to some good 'hello world' type of samples out
there?

Thanks, J
 
Well, the MS KB has examples of Extended MAPI code, as does the Exchange
SDK. There's a newsgroup for MAPI,
microsoft.public.win32.programmer.messaging, and a MAPI list, the MAPI-L
list.

You can also look at http://www.outlookcode.com/d/mapi.htm for more links
and code samples.
 
Back
Top