I wrote these rules out while debugging a crash in another MS product:
I won't name the app, but it violated all 4 rules.
Known consequences of violating these rules:
Someone - who? We know our code and can't think of anything the worker threads do that would automatically get MAPI initialised.
I don't think luck comes into it. We're not being very lucky with this project. ;)
Can you elaborate on the contention we're seeing inside the MAPI calls on our worker threads? Is that normal in any multi-threaded application's heavy use of MAPI?
In doubting my sanity over this issue I've subsequently run our gateway under debug with a breakpoint set on _MAPIInitialize@4. It's hit once - from the service initialisation message processing loop. I'm as certain as I can be that there are no per-thread calls to MAPIInitialize. Nevertheless we don't experience any issues making MAPI calls from the worker threads.
Are there perhaps significant differences between the threading/MAPIInitialize requirements of the server version (Exchange 2003) of MAPI and the client version of MAPI?
Also, we've tried explicitly calling MAPIInitialize from the worker threads and while it hasn't caused any issues, it's not had any noticable effect on the contention we see inside MAPI calls. BTW, the parallel stacks debugging view in VS2010 is very illuminating for these situations.
The contention has nothing to do with initializing MAPI (though you should still initialize it on every thread). The contention is because many operations in MAPI and in the ems providers are serialized.
First, good job with this blog.
I have a problem with my MAPI program (writen in C++.NET).
My program is a service, so I initialize MAPI with MAPI_NO_COINIT and MAPI_NT_SERVICE flags.
But MAPIInitialize returns me the error 0x80004005.
I wrote a second program (console) that make a MAPIInitialize but with MAPI_NO_COINIT flag only.
MAPI has initialized with no problem.
Do you know if it could be a problem of multi processor?
And if I remove the flag MAPI_NT_SERVICE in my service program, what could be the consequently?
Environment (new computer, office installed only):
Office 2003 v11.0.8173.0
Administrator of my computer
Please let me know in your opinion, general considerations in improving performance of OUTLOOK Addin using MAPI?
MAPIInitialize fails with error MAPI_E_NOT_ENOUGH_RESOURCES abruptly for a binary 'XYZ' (MAPIInitialize with MAPI_MULTITHREAD_NOTIFICATIONS parameter).
I have another service running all the time which uses MAPI initialized with MAPI_MULTITHREAD_NOTIFICATIONS.
If this service is closed or restarted, the MAPIInitialize is successful again for few instances of binary 'XYZ'.
It was working fine when binary 'XYZ' was not passing MAPI_MULTITHREAD_NOTIFICATIONS to MAPIInitialize.
Do you think MAPI_MULTITHREAD_NOTIFICATIONS cause any king of MAPI issue if 3-4 binaries are run in parallel.