Extended MAPI calls on 2nd thread?

E

Eric

Is it okay to make Extended MAPI calls on a 2nd thread from a COM
add-in? I use MapiLogonEx() to get the IMAPISession pointer on the
main thread, which I work with it on the main thread as well, but now
I'm working on another process which I'd like to do on a 2nd thread.
Can I use the same pointer on the 2nd thread as well, or do I need to
call any init/logon functions again from the 2nd thread? I know MAPI
can be used with multiple threads, but I think it depends on how you
initialize it, and in this case Outlook is doing most of the
initialization for me, so thought I'd check with the experts...
 
D

Dmitry Streblechenko \(MVP\)

Yes, you should be Ok as long as you don't forget to wrap the thread into
MAPIInitialize/MAPIUninitialize.
BTW, you can retrieve IMAPISession from OOM using Namespace.MAPIOBJECT in
Outlook 2002 and up.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
E

Eric

Thank you. The 2nd thread is working like a champ. I haven't added
the init/deinit calls yet, but I will, since it seems like a good
practice.
 

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