On Jan 21, 2016, at 9:27 AM, Srinivasa, Vish 
<vish.sriniv...@elavon.com<mailto:vish.sriniv...@elavon.com>> wrote:

           This is about a process that runs as a Windows 7 service. It is a 
python executable that I am trying to run as a service and when it is executed 
from the commandline it runs fine. However when it runs as a local account 
(which is the same user as the user that runs it from commandline) it fails 
with the following error:-

                                                      (<class 
'pywintypes.com<http://pywintypes.com/>_error'>, com_error(-2147024891, 'Access 
is denied.', None, None)

The line where it fails is the following:-

                                                   MyConn = 
win32com.client.gencache.EnsureDispatch("Outlook.Application").GetNamespace("MAPI”)

For security reasons, services in Windows run in what is called “session 0”, 
which is prohibited from connecting with the desktop.  The Outlook application 
is a GUI application, so it cannot run in session 0.

There are a couple of alternatives.  You can modify the service configuration 
to allow it to interact with the desktop, or you can connect with MAPI without 
going through Outlook.

https://msdn.microsoft.com/en-us/library/office/cc839856.aspx
—
Tim Roberts, t...@probo.com<mailto:t...@probo.com>
Providenza & Boekelheide, Inc.

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

Reply via email to