Is MAPI multithread-friendly?

  • Thread starter Vladimir Chtchetkine
  • Start date
V

Vladimir Chtchetkine

Unlike Outlook API? I mean it's known that Outlook's API is safely available
only within context of a UI thread. In an arbitrary thread OutlAPI fails
(sometimes). Is MAPI free from this restriction?

What I'm thinking to do (as a solution to my problem with preview pane
described in another post in this group) is working directly with MAPIOBJECT
(which is IMessage) for each item I need to touch in an arbitrary thread.
So, basically, the solution that I have in mind is:

1. When initializing my addin I build a list of IMAPIFolders that I'm
interested in.

2. For each IMAPIFolder list and save all item's EntryIDs (PR_ENTRYID)

3. Create a regular thread (with _beginthread for those of you who's
familiar with SDK) for synchronizing folder's content with some external
data server.

4. In this thread use IMAPIFolder.OpenEntry using entry ID for each entry
listed in step 2

5. Sync that item using its MAPI (IMessage) interface



How that looks to the experts? :)
 
H

Helmut Obertanner

Hello Vladimir,

I have done such a background thread in an C# AddIn.
After Sync, loop over an Folder to build up a List into Database.
Later i can use the list for selecting the Contacts in a ComboBox.
Had no problems, only have to get rid of when outlook is closing, or user
starts sync again before thread is finished.

Greets, Helmut Obertanner
 

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