Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MAPI_E_CALL_FAILED on MAPIInitialize

137 views
Skip to first unread message

mtim...@gmail.com

unread,
Oct 28, 2007, 12:25:57 AM10/28/07
to
My MAPIInitialize call seems to fail for some (high) percentage of the
users who run my software. Here's the call, in Python:

mapi.MAPIInitialize((mapi.MAPI_INIT_VERSION,
mapi.MAPI_MULTITHREAD_NOTIFICATIONS))

I've also tried not passing any args and not passing
MAPI_MULTITHREAD_NOTIFICATIONS.

I've read about two possible causes for this issue:

* The user does not use Outlook as the default mail app. I get around
this issue by inserting my app into HKEY_LOCAL_MACHINE\SOFTWARE
\Microsoft\Windows Messaging Subsystem\MSMapiApps and specified a
value of "Microsoft Outlook". I tested on my machine and verified that
this fixes the error when Outlook is not the default. I also call
FIXMAPI.exe in my software before initializing MAPI to ensure that the
user has the stub dll installed properly.

* The user is using Outlook in Internet Mail Only mode. I'm not sure
how to detect this condition since I don't know which API to use to
detect the mode, although I don't think this can be responsible for
the high percentage of failures I'm seeing (esp. since Outlook 2003+
users are failing and my understanding is that those versions don't
have this mode).

Does anyone know of any other reason why MAPIInitialize might return
this error for so many users (most of whom are on WinXP, SP2)? Thanks
very much.

Mark

Dmitry Streblechenko

unread,
Oct 28, 2007, 2:34:01 AM10/28/07
to
Most likely you are loading the mapi32.dll library installed by OE in the
system32 folder instead of loading the Outlook version of the dll
(msmapi32.dll) from Program Files.

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

<mtim...@gmail.com> wrote in message
news:1193545557.5...@k35g2000prh.googlegroups.com...

mtim...@gmail.com

unread,
Oct 28, 2007, 2:38:34 AM10/28/07
to
Thanks for the response, but why would this be happening if I set the
registry keys? Shouldn't the MAPI stub be finding my exe value, seeing
that I declared "Microsoft Outlook" and retrieving the correct DLL
path from that? As I noted, I did ensure that this works on my
computer even if Outlook Express is the default (with this registry
fix).

On Oct 27, 11:34 pm, "Dmitry Streblechenko" <dmi...@dimastr.com>
wrote:


> Most likely you are loading the mapi32.dll library installed by OE in the
> system32 folder instead of loading the Outlook version of the dll
> (msmapi32.dll) from Program Files.
>

> Dmitry Streblechenko (MVP)http://www.dimastr.com/


> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>

> <mtimo...@gmail.com> wrote in message

Dmitry Streblechenko

unread,
Oct 28, 2007, 11:33:46 AM10/28/07
to
*If* you end up calling the stub: other mail clients can be replacing
mapi32.dll with their own versions.
fixmapi.exe restores the stub dll.

Dmitry Streblechenko (MVP)


http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

<mtim...@gmail.com> wrote in message
news:1193553514.9...@q3g2000prf.googlegroups.com...

Message has been deleted

Dmitry Streblechenko

unread,
Oct 28, 2007, 5:09:59 PM10/28/07
to
Do you still get the error after all these checks?

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

"blakeross" <blak...@gmail.com> wrote in message
news:1193601565....@e9g2000prf.googlegroups.com...
>I don't know how to verify that MAPIInitialize is actually calling
> through the correct stub, but I do verify that the dll loaded by
> LoadLibrary("MAPI32.DLL") is the stub (by virtue of the existence of
> the GetOutlookVersion function, which indicates the stub according to
> MSDN). Is that sufficient to verify that the stub is being used? (I
> also do call FIXMAPI first.)
>
> I've further verified that my registry value is correctly placed under
> the MSMapiApps key and that the Microsoft Outlook key does exist under
> Clients\Mail with a DLLPathEx value. Further, I've verified that the
> DLL specified by this value (usually "C:\Program Files\Common Files
> \SYSTEM\MSMAPI\1033\msmapi32.dll") is in fact loaded into the
> customer's process after MAPIInitialize fails. I've also tried adding
> the NO_COINIT flag since I CoInitialize myself before MAPIInitialize
> as a single-threaded apartment. Can you think of anything else to try
> here?
>
> Thanks a lot.
> Mark


>
> On Oct 28, 8:33 am, "Dmitry Streblechenko" <dmi...@dimastr.com> wrote:
>> *If* you end up calling the stub: other mail clients can be replacing
>> mapi32.dll with their own versions.
>> fixmapi.exe restores the stub dll.
>>

Message has been deleted

mtim...@gmail.com

unread,
Oct 29, 2007, 1:11:21 AM10/29/07
to
Yes I do. Sometimes. Do you know of any other circumstances where this
might happen?

Separately, many of my customers fail the MAPIInitialize call, and
when I examine their registry, they don't have a Microsoft Outlook key
under Clients\Mail. (Note that my question above concerns the case
where it fails even when this key DOES exist.) Assuming they have
Outlook installed, is there anything that would cause this beyond
random registry corruption? And is there any good fix?

On Oct 28, 2:09 pm, "Dmitry Streblechenko" <dmi...@dimastr.com> wrote:
> Do you still get the error after all these checks?
>

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

> "blakeross" <blaker...@gmail.com> wrote in message

Dmitry Streblechenko

unread,
Oct 29, 2007, 12:54:20 PM10/29/07
to
How many times do you call MAPIInitialize?
Most client versions of MAPI break downa after
MAPIInitialize/MAPIUninitialize pair is called a few (400-500) times.

Dmitry Streblechenko (MVP)


http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

<mtim...@gmail.com> wrote in message
news:1193634681.2...@t8g2000prg.googlegroups.com...

mtim...@gmail.com

unread,
Oct 29, 2007, 4:52:54 PM10/29/07
to
I only call it once. Any more ideas? Any more debugging info that
would be helpful to collect?

On Oct 29, 9:54 am, "Dmitry Streblechenko" <dmi...@dimastr.com> wrote:
> How many times do you call MAPIInitialize?
> Most client versions of MAPI break downa after
> MAPIInitialize/MAPIUninitialize pair is called a few (400-500) times.
>

Dmitry Streblechenko

unread,
Oct 29, 2007, 5:33:04 PM10/29/07
to
How do you load mapi32.dll? Can you explciitly link to msmapi32.dll in
Program Files just as a test?

Dmitry Streblechenko (MVP)


http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

<mtim...@gmail.com> wrote in message
news:1193691174....@q5g2000prf.googlegroups.com...

0 new messages