[python-win32] how to create a instance of PyIMAPISession by hand

Christian K. ckkart at hoc.net
Wed May 8 15:29:38 CEST 2013


The following code has been suggested to me to get a handle to Outlook's
mapi session.


from win32com.client import Dispatch
from win32com.mapi import mapi
app = Dispatch('Outlook.Application')
app.GetNamespace('MAPI').Session.MAPIOBJECT

The MAPIOBJECT would then have to be cast to a IMAPISession object. How
would I do that? By calling the PyIMAPISesison constructor with MAPIOBJECT
as argument? Unfortunately I was not able to find the PyIMAPISession class
in the pywin32 namespace nor when digging through the source.

<PyIUnknown at 0x020D0F20 with obj at 0x003A53DC>

Any hints are very much appreciated.

Christian



More information about the python-win32 mailing list