This code run without problem in release r debug when Visual studio isn't started as an admin.
Marshal.GetActiveObject("Outlook.Application");
However, when I start Vs as administrator and run the same line in debug, I get the following error:
System.Runtime.InteropServices.COMException
Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))
How can I fix this.
I would guess that you are running Visual Studio as Administrator (started via Run as Administrator) while Outlook was opened as user, who was logged in as under Windows logon. So the Visual Studio is running under different user than Outlook client.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With