Try:
 
outlook=win32com.client.GetActiveObject("Outlook.Application")
 
Mark.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Amrit Jassal
Sent: Tuesday, 31 January 2006 8:59 AM
To: python-win32@python.org
Subject: [python-win32] MAPI,windows service and getting handle to executing outlook process

I am writing a mail extractor program to download mail from outlook via MAPI. The script works fine as a console program and as an NT service if outlook is not running.
If outlook process is running then the service times out with the following exception:

  File "win32com\client\__init__.pyc", line 95, in Dispatch
  File "win32com\client\dynamic.pyc", line 91, in _GetGoodDispatchAndUserName
  File "win32com\client\dynamic.pyc", line 79, in _GetGoodDispatch
com_error: (-2146959355, 'Server execution failed', None, None)

at the line: outlook = win32com.client.Dispatch("Outlook.Application")

I see that there is a new OUTLOOK.EXE process created as well. Looks like I need to get a handle to the executing process and not spawn a new one.

Anybody has faced this before and provide some pointers?

Thanks for your help.


_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to