[python-win32] MAPI Advise Sink
Brenda Bell
bb31l at theotherbell.com
Tue Aug 5 18:51:23 CEST 2008
I'm trying to write a simple program that connects to MAPI and listens
for change events on the contents table for the default receive folder.
According to the documentation, PyIMAPITable.Advise takes a
PyIMAPIAdviseSink. It's unclear as to how I implement an object that
supports this interface.
The IMAPIAdviseSink interface is defined in mapi32.dll, but mapi32.dll
does not contain a type library. I have been able to implement a Sink
class:
IID_IMAPIAdviseSink = pythoncom.MakeIID('{00020302-0000-0000-
C000-000000000046}')
IID_Sink = pythoncom.MakeIID('{65C60411-8743-4c0a-863F-757831F8E56B}')
class Sink():
_com_interfaces_ = [IID_IMAPIAdviseSink]
_reg_progid_ = 'Python.CarboniteMapiAdviseSink'
_reg_clsid_ = str(IID_Sink)
_public_methods_ = ['OnNotify']
def OnNotify(self, foo, bar):
print "Notification triggered."
I can create an instance as long as I ask for IUnknown:
sink = pythoncom.CoCreateInstance(IID_Sink, None,
pythoncom.CLSCTX_ALL, pythoncom.IID_IUnknown)
But if I ask for IID_IMAPIAdviseSink or attempt to pass the IUnknown
to Advise, policy.py fails with "No such interface supported".
Can someone point me to a sample or to documentation that will help me
figure out what I'm doing wrong?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20080805/3807c79c/attachment-0001.htm>
More information about the python-win32
mailing list