1

I created an Windows application, using the Redemption library. This application simply access the Stores from Outlook and store messages in a web application. I am using the RedemptionLoader class, so I don't need to register Redemption. The problem I am facing is that my application simply crashes when it is used on a machine that contains an Office 64-bit.

At first, I was building the project with "Any CPU" configuration. After reading the FAQ from Redemption website, I adjusted the build settings, so I can deploy the application both in 32-bit ("x86") and 64-bit ("x64"). The Office installed in my machine is 32-bit, so both "Any CPU" and "x86" works like a charm. Meanwhile, my team members had Office 64-bit installed in their machines and the program using the "x64" build simply crashes, without any error message. Then, we tried to run the program with "x86" configuration, but the program throws an Exception (Wrong OS or OS Version), which I get it, because the Office is 64-bit.

So, after debugging the application, I found that the crash is happening in the RedemptionLoader class, in the line shown below.

ClassFactory.CreateInstance(null, ref IID_Unknown, out res);

In those machines, the installed Office is the 365 version. I don't know if there is a relation or not. I simply follow the instructions I read, so I don't know what I am missing here.

  • I wonder what requirement, if any, is enforcing you to use redemption. If you only use it to send emails whose sender is the user, you could use .net API email related classes, redemption is so old. – Cleptus Sep 03 '19 at 12:58
  • Redemption is awesome dude!! Don't look like he is trying to send an e-mail... – Anderson Rissardi Sep 03 '19 at 13:04

1 Answers1

1

As noted in the FAQ, since Redemption loads the MAPI system in-proc (MAPI is a set of dlls), it bitness must match the bitness of the MAPI system / Outlook. And since Redemption is also loaded in-proc by your code, your app's bitness must also match the bitness of the MAPI system.

This means that your app must be compiled in two versions - x86 and x64 and the version matching the bitness of Outlook needs to be installed. A workaround is to move Redemption/MAPI related functionality in a separate exe, compile it in 32 and 64 bit versions, and launch the right version of that auxiliary exe by your main executable at run-time.

The only exception is a COM addin - since it is always loaded by OUtlook, "Any CPU" would work fine since the bitness of your code will always match that of Outlook.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78