[python-win32] win32com.client.Dispatch("MAPI.Session") error exchange 2003

Adnan Chowdhury adnan.chowdhury at gmail.com
Mon Nov 14 05:13:18 CET 2005


Found the answer at
http://groups.google.com/group/comp.lang.python/browse_frm/thread/20f31e67c4d01d31/4d984204876e3319?q=exchange&rnum=35#4d984204876e3319
(comp.lang.python:"Q: Basic MAPI")

You have to specifically install CDO components when installing
Outlook 2003, it is not installed by default.

ac

On 14/11/05, Adnan Chowdhury <adnan.chowdhury at gmail.com> wrote:
> I'm trying to connect to an Exchange 2003 server win ActiveState's
> python implementation 2.4.1.
>
> When I run the following code:
> import win32com.client
> session = win32com.client.Dispatch ("MAPI.Session")
> session.Logon (ProfileName="Adnan Chowdhury")
>
> I get this error:
> Traceback (most recent call last):
>   File "MAPI Test.py", line 3, in ?
>     session = win32com.client.Dispatch ("MAPI.Session")
>   File "C:\Python24\Lib\site-packages\win32com\client\__init__.py",
> line 95, in Dispatch
>     dispatch, userName =
> dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
>   File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py",
> line 91, in _GetGoodDispatchAndUserName
>     return (_GetGoodDispatch(IDispatch, clsctx), userName)
>   File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py",
> line 79, in _GetGoodDispatch
>     IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
> pythoncom.IID_IDispatch)
> pywintypes.com_error: (-2147221005, 'Invalid class string', None, None)
>
> Is there something more that I need to define?
>


More information about the Python-win32 mailing list