views:

845

answers:

4

I've got a legacy application that creates an email message with an attachment. The code uses the MAPI interface to create the message. This code has worked for quite some time.

When the application is run on a Windows 7 64 bit machine, the call to MAPILogon fails with a generic error code.

Is there an incompatibility with MAPI and Win7 64? Or is there some COM issue that I am not aware of?

A: 

not sure specifically in regards to MAPI, but can be if its done in .NET

Keith Nicholas
Can you please elaborate on "can be if its done in .Net"?
epotter
I've had problems with .net if it isn't compiled for 32bits, it will automatically use 64bits and thats broken things where its using a 32bit COM component
Keith Nicholas
+1  A: 

It looks like the problem depends on which API calls you are using.

Calls to MAPISendMail should work without a problem.

For all other MAPI method and function calls to work in a MAPI application, the bitness (32 or 64) of the MAPI application must be the same as the bitness of the MAPI subsystem on the computer that the application is targeted to run on.

In general, a 32-bit MAPI application must not run on a 64-bit platform (64-bit Outlook on 64-bit Windows) without first being rebuilt as a 64-bit application.

For a more detailed explination, see the MSDN page on Building MAPI Applications on 32-Bit and 64-Bit Platforms

epotter
A: 

I experienced something like this with a legacy application using Crystal Reports 8.5. The CR report viewer has an "Export" button which brings up a dialog which lets you pick a "Destination", one of which is "Microsoft Mail (MAPI)". Exporting to MAPI was failing on Windows 7.

Apparently the problem was due to Microsoft dropping support for "Simple MAPI" in Windows 7.

We were able to resolve the problem with this hotfix from Microsoft: http://support.microsoft.com/kb/980681

Here's some other discussion which might be helpful for anyone with a similar problem:

Jeff Roe
A: 

Hi,

Try this

@echo off REM NOTE: The MAPI32.dll must be included in the same directory as this patchfile!! REM NOTE: change the username to corresponding if you're not on a domain remove @domain

takeown /f c:\windows\system32\mapi32.dll cacls c:\windows\system32\mapi32.dll /G administrator@domain:F ren c:\windows\system32\mapi32.dll c:\windows\system32\mapi32.dll.ORIGINAL copy mapi32.dll c:\windows\system32\mapi32.dll

if NOT '%PROCESSOR_ARCHITECTURE%'=='AMD64' goto END takeown /f c:\windows\sysWOW64\mapi32.dll cacls c:\windows\sysWOW64\mapi32.dll /G administrator@domain:F ren c:\windows\sysWOW64\mapi32.dll c:\windows\sysWOW64\mapi32.dll.ORIGINAL copy mapi32.dll c:\windows\sysWOW64\mapi32.dll :END

Clark Birkelund