PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Program Addins Is it possible to open an Outlook Item from a non-Outlook thread (using OOM) ?

Reply

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

 
Thread Tools Rate Thread
Old 30-06-2003, 06:50 PM   #1
George Wang
Guest
 
Posts: n/a
Default Is it possible to open an Outlook Item from a non-Outlook thread (using OOM) ?


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:isplay method, Outlook
will crash.

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


Thanks!

-G
  Reply With Quote
Old 11-08-2003, 03:25 PM   #2
Benoit Gantaume
Guest
 
Posts: n/a
Default Re: Is it possible to open an Outlook Item from a non-Outlook thread (using OOM) ?

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.
++

"George Wang" <wzhao2000@yahoo.com> a écrit dans le message de
news:71620164.0306300850.2a602398@posting.google.com...
> 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:isplay method, Outlook
> will crash.
>
> Maybe the item.Display method can only be called from an Outlook
> thread? Is there a workaround?
>
>
> Thanks!
>
> -G



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off