[python-win32] Connecting to Exchange in a MAPI.Session from a service.

Aaron Patrick Lehmann lehmanap at cs.purdue.edu
Sun Nov 7 12:44:57 CET 2004


Hello all--

I'm trying to use the following code to set up a MAPI.Session with an Exchange
server.  It works fine from the command prompt, but when I try to run it as a
service it fails with a MAPI_E_LOGON_FAILED Error.


	def _getCDO(self, profile, password ):
		"""
		This method gets a CDOSession.
		
		Arguments:
		--------------------------------------------------------------
		profile:	Tracker's profile name on the Windows Computer.
		password:	Tracker's password for this profile
	
		Returns:
		--------------------------------------------------------------
		A CDO Session
		"""

		CoInitialize( )
		#Initialize COM, if it hasn't been initialized already.
		cdo = Dispatch("MAPI.Session", "Tracker")
		cdo.Logon(profile, password, False)
		return cdo

Is there something extra I need in order to run this code as a service?  I
appreciate your help.

Aaron Lehmann
-- 
Why do the Democrats complain about Nader losing them Presidential elections?
Republicans don't complain about Libertarians.


More information about the Python-win32 mailing list