[python-win32] Implementing IID_IMAPIAdviseSink
Arn Vollebregt
arn.vollebregt at xs4all.nl
Wed Aug 26 00:21:10 CEST 2009
Hi,
I am trying to hook an advise sink into Outlook to receive new email
notifications, but I cannot find any examples on this. I've scraped together
the code below, but that yields an error. Can anybody point me to a working
sample, or provide a quick sample of how to imlement this? I've been banging
my head on this for some days now, I am not making any progres...
<code>
class Sink():
_com_interfaces_ = [mapi.IID_IMAPIAdviseSink]
_reg_progid_ = 'IMAPIAdviseSinkTest'
_reg_clsid_ = str(mapi.IID_IMAPIAdviseSink)
#_reg_clsid_ = str(pythoncom.CreateGuid())
_public_methods_ = ['OnNotify']
def OnNotify(self, foo, bar):
print "DEBUG: received an OnNotify()"
def main():
sink = pythoncom.CoCreateInstance(Sink._reg_clsid_, None,
pythoncom.CLSCTX_ALL, mapi.IID_IMAPIAdviseSink)
if __name__ == '__main__':
main()
</code>
<error>
sink = pythoncom.CoCreateInstance(Sink._reg_clsid_, None,
pythoncom.CLSCTX_ALL, mapi.IID_IMAPIAdviseSink)
pywintypes.com_error: (-2147221164, 'Class not registered', None, None)
</error>
Thank you in advance,
Arn Vollebregt
P.S.: Yes, I am running build 214 :)
More information about the python-win32
mailing list