Is it possible to open an Outlook Item from a non-Outlook thread (using OOM) ?

  • Thread starter Thread starter George Wang
  • Start date Start date
G

George Wang

Hello, there:

I'm implementing an Outlook COM Add-in which captures item open event.
Because this guy will do some lengthy thing, so I just save the item
EntryID and close it right away.

At backend, the Add-in will do its work. After completed, it will use
GetItemFromID() get the item and call its Display() method to display
it. But after the item shows up, Outlook will crash.

=== excerpt of pseudo code ======

IDTExtensibility2::OnConnection(..)
{
// store pointer of Outlook Application
}

MailItemEvents::Open(..)
{
// store item Entry ID and store Entry ID
// start a UI display progress and a worker thread to the job
// close MailItem
}
=================================

After worker thread completes, UI thread use Outlook Application ->
get NameSpace -> GetItemFromID(Entry ID + Store ID).

So far no problem. But when call the Item::Display method, Outlook
will crash.

Maybe the item.Display method can only be called from an Outlook
thread? Is there a workaround?


Thanks!

-G
 
No!
You can not use OOM from a different thread than the one launched by
Outlook!
Two solutions:
- Create a new object application in your thread (i have not tested)
- Change your access method to use Extended MAPI: you can use multi
thread.
(of course you can mix OOM and MAPI)

good luck: we had the same pb.
If you have found an other solution, i am curious to know it.
++
 
Back
Top