Simple MAPI send and Outlook COM addin

M

Mark Smith

I've got a COM addin that adds a toolbar to Outlook inspectors.

In another process I call the Simple MAPI MAPISendMail function. When the
new e-mail dialog pops up, my addin toolbar does not appear. I figured out
that the same behavior happens if I open up a new send e-mail dialog via the
send to mail shell context menu.

I heard a long time ago that in some cases Outlook opens in a mode where no
addins are loaded. However, even if Outlook is already running (in which
case my addin is already loaded), my addin toolbar does not appear. I ran
through it with a debugger, and none of my code is hit for this particular
inspector.

What if I use Extended MAPI to do this? Since it happens for both Simple
MAPI and the shell send to mail context menu, I'm assuming that it won't work
for Extended MAPI either. Is there something else I can do about this or is
it just a limitation of Outlook?

Thanks
Mark Smith
 
K

Ken Slovak - [MVP - Outlook]

When a Simple MAPI message is opened by Outlook any addins will run if
Outlook is running already, and if the addin is correctly written it will
run even if Outlook wasn't previously running. It all depends on how the
addin is written and what it does when OnConnection is fired.

A new Inspector opened from a Simple MAPI message is added to the Inspectors
collection, but it doesn't fire the Inspectors.NewInspector() event. Since
that's how most code will discover an Inspector was opened the code won't
know about the new Inspector, unless you scan the Inspectors collection and
account for any open Inspectors that aren't already being handled.

Using Extended MAPI won't help with this, the limitations would be the same.
 
M

Mark Smith

Thanks for the reply Ken.

I finally got back to this issue, and I've got a few more questions.

As far as finding the new inspector without the NewInspector event firing,
are you suggesting doing something like a timer based polling? Or is there
some other event to trap? I didn't see anything that looked like it would
work. Maybe I'm looking in the wrong place...

You also say that for the case where Outlook isn't already running the addin
should load. I rechecked my code and the addin does get loaded. However I
tried checking the inspector collection in the OnStartupComplete event, which
is the last one that I get other than the ones for the inspectors or toolbars
themselves. The inspector collection is still empty at this point. So
again, is there some other later event to trap, or am I stuck with a polling
solution here also?

Thanks,
Mark Smith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top