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?