This project has moved and is read-only. For the latest updates, please go here.

Retrieving Outlook Instance Not Created By NetOffice

May 9, 2013 at 4:16 PM
Hi there,

We are having issues trying to attain an instance of NetOffice.OutlookApi.Application through GetActiveInstances and System.Runtime.InteropServices.Marshal.GetActiveObject("Outlook.Application");

For GetActiveInstance and GetActiveInstances we are able to retrieve the instance created by our application, but not one created outside the application. When Outlook is opened outside of our application and we call these methods, they return null and an empty Application[] array respectively.

When trying to use GetActiveObject("Outlook.Application"); we are presented with a COMException detailing that Outlook.Application does not exist for us to retrieve. The exception is as follows:
Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE)).

This exception appears even if we use the PID or Outlook.Application.14

Could you tell us what we are doing wrong?
May 9, 2013 at 9:31 PM
a typical problem could be the security.
if your code runs without admin permissions you got all proxies from applications without.
if your code runs with admin permissions you got all proxies from applications with admin permissions(no com proxies without admin privileges)
is this helpful for you?
Sebastian
May 9, 2013 at 9:41 PM
Hi Sebastian,

Thanks for the reply.

We are calling this function from Visual Studio with and without debugging while running with administrative privileges. Are you suggesting that doing the same without these privileges will allow us to obtain the reference? Also is this suggestion based on GetActiveObject or GetActiveInstance(s)?

We have also seen mention of a slightly similar error in which the 32 bit instance of Outlook is running on code set to build in 64 bit. This is the case for us although switching build architecture will require quite a few modifications - so only worth trying if it is likely the cause. Also it is fair to expect that clients will use 32 bit Office applications on 64 bit machines.

Regards
May 9, 2013 at 10:00 PM
did you have skype or msn?