0

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

  • Reinstalling the entire machine from scratch
  • Reinstalling Office
  • Repairing Office
  • Checked the registry to see if multiple version of Office are present
    • There is only one version - "9.6" (Microsoft Office Standard 2019)
  • Run regsvr32 on the Redemption dll

Info:

  • Skype/Skype for business is not installed
  • Exchange Online is used, not om premise
  • Windows, Outlook and our native application are all x64

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?

Casper Olsen
  • 1
  • 1
  • 5
  • If it's just one client installation that fails with these errors, try to find what's specific on there. Check what are the .dll loaded into outlook.exe, especially 3rd party .dll (not Microsoft) using for ex ProcExp tool from sysinternals. Also check bitness (x86 vs x64). Check the disk is not corrupted, viruses, etc. Multithreading and timing/race condition can also cause unusual errors. If you can reproduce the registration issues, use ProcMon tool from sysinternals to monitor registry access at that time. – Simon Mourier Aug 05 '21 at 08:23
  • @SimonMourier The bitness is the same: Windows, Outlook and our native application are all x64. I'll try to look into the other things. Thank you :) – Casper Olsen Aug 05 '21 at 12:38

2 Answers2

0

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).

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

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.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45