views:

30

answers:

0

Hello.

In my code, I want to get an object representing Outlook 2010.

It seems that I am able to start-up a new version of Outlook 2010 without receiving an error. I use this code to start it up:


  oApp = new Microsoft.Office.Interop.Outlook.Application();

However, if Outlook 2010 is already running, I can't get a version of that application to work with. I use this code to try and get the running Outlook 2010 application:


oApp = Marshal.GetActiveObject("Outlook.Application") as Microsoft.Office.Interop.Outlook.Application;

Using the latter outputs an error:

Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))

What does this error mean? How can I solve it? I'm running this on a Windows 7 machine.

Any help would be appreciated. Thanks.