We have a functionality to add contacts to outlook.
I simply want to do it to existing outlook process if one is running or open if not running.
I get error:
Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).in case the process in not already running.
Note: the below method is called 2 times.
My code is:
Private Sub InitObject()
If (Process.GetProcessesByName("OUTLOOK").Count > 0) Then
objOutlook = DirectCast(Marshal.GetActiveObject("Outlook.Application"), Outlook.Application)
'If objOutlook Is Nothing Then
Else
objOutlook = New Outlook.Application()
End If
If objNamespace Is Nothing Then
objNamespace = objOutlook.GetNamespace("MAPI")
objNamespace.Logon("", "", False, False)
End If
If objFolder Is Nothing Then
objFolder = objNamespace.GetDefaultFolder(10)
End If
End Sub
I read several posts on this saying admin privileges and all. Now I am running Visual Studio without Admin rights. I am sacred is this error will be seen in production too where we don't use Visual Studio?
What Outlook version do you have installed on the problematic PC? Is it the Click2Run edition of Outlook 2010?
Anyway, I see two possible causes for that:
Be aware, Outlook is a singleton. I.e. if it is already running, you will get a pointer to the already running instance when you create a new Outlook Application instance.