[python-win32] Casting to a specific interface

Amrit Jassal ajassal at gmail.com
Thu Mar 9 21:20:42 CET 2006


I have a fairly basic question.
I am trying to map a PyIUnknown interface to a specific (in this case
IMAPIStatus) interface. How do I do that?

Here is what I have:

        import mapi, ...

        tab = self.session.GetStatusTable(0)
        rows = mapi.HrQueryAllRows(tab,
                                   (PR_ENTRYID, PR_RESOURCE_TYPE),   #
columns to retrieve
                                   None,     # all rows
                                   None,            # any sort order is fine
                                   0)               # any # of results is
fine
        for row in rows:
            (eid_tag, eid), (res_tag, res_name) = row
        if res_tag == PR_RESOURCE_TYPE and res_name == 37:    # MAPI_SPOOLER
                stat = self.session.OpenEntry(eid, None,
mapi.MAPI_DEFERRED_ERRORS)
        stat.FlushQueues(None, None, 0x10)    # FLUSH_NO_UI

FlushQueues() obviously requires a IMAPIStatus interface. The documentation
for OpenEntry() states that passing NULL should give me the correct
interface type.

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20060309/9dbf8582/attachment.htm 


More information about the Python-win32 mailing list