Casper Olsen
Casper Olsen

Reputation: 1

Intermittent COM and MAPI errors in native application

The problem

We have a native application, that integrates with Outlook through COM/interop. Intermittently we experience different errors relating to COM, MAPI, Redemption and the Windows Registry. And this is only at a single client installation.
It works 95-99% of the time. This percentage is extrapolated from looking at our log files.

We have quite a few other client installations, that never get the errors with the same version (same code) of the native application. We only experience the errors at this one client installation.

That leads me to believe the problem is likely to stem from something different at the client installation and not the code. But this is of course only a hypothesis.

Errors

Error one

Exception from HRESULT: 0x8002801D (TYPE_E_LIBNOTREGISTERED)
When calling:

var outlookApp = (Application) Marshal.GetActiveObject("Outlook.Application");
var mapiObject = outlookApp.GetNamespace("MAPI").MAPIOBJECT; // <-- This line causes the error

at Microsoft.Office.Interop.Outlook.ApplicationClass.GetNamespace(String Type)

Error two

Interface not registered (Exception from HRESULT: 0x80040155)
When calling:

Microsoft.Office.Interop.Outlook._MailItem.get_Attachments()

Error three

Error in MAPILogonEx: MAPI_E_LOGON_FAILED
When calling:

Redemption.IRDOSession.Logon(Object ProfileName, Object Password, Object ShowDialog, Object NewSession, Object ParentWindowHandle, Object NoMail)

Tried so far

Info:

The strange thing is that is works most of the time. If it was a problem with the registration (registry), i would expect it to fail every time.
It looks like it might be a MAPI problem, but again it works most of the time.

I have been researching the problem for a few days now and haven't been able to find out why the problems are occurring intermittently. I have found a lot of information on the different errors, but they all seem to occur consistently; the errors occur every time the code is called in the error scenarios i have found.

Has anyone experienced anything similar or know why it might be happening?

Upvotes: 0

Views: 483

Answers (2)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66341

TYPE_E_LIBNOTREGISTERED and REGDB_E_IIDNOTREG errors are a pretty strong indication that some COM registry keys are missing. Try to completely uninstall and then reinstall Outlook (not just Repair).

Upvotes: 0

Eugene Astafiev
Eugene Astafiev

Reputation: 49453

Your machine is corrupted or any malware is presented. The problem is not related to the Redemption library because even the Outlook object model gives errors related to windows registry keys required for the COM interoperability.

Upvotes: 0

Related Questions