How to access a property in Outlook using win32com?

Tim Peters tim.one at comcast.net
Wed Nov 20 22:26:08 EST 2002


[Jonas Bengtsson]
> By using win32com.client I am able to access my mails (as
> MailItem objects) in Outlook using Python. The common stuff like
> Subject, Body, To etc is easy to access. But I have no idea how to
> access the property PR_TRANSPORT_MESSAGE_HEADERS. I found it by
> using OutlookSpy [1].
>
> Can anyone tell me how to access that property?

Heh.  I doubt it, but we can *show* you:  check out the Outlook2000
directory in the spambayes project:

    http://tinyurl.com/2vt5

and especially MAPIMsgStoreMsg._GetMessageText() in msgstore.py there.

PR_TRANSPORT_MESSAGE_HEADERS is a MAPI property (not part of the *Outlook*
object model), and it even took Mark Hammond several days to figure out how
to access it without going thru CDO (Collaboration Data Objects -- yet
another API-on-an-API-on-an-...).

Be forewarned that the exact meaning of PR_TRANSPORT_MESSAGE_HEADERS isn't
defined by MAPI, may contain lines that aren't valid SMTP headers, and can
ne downright strange when looking at msgs handled by an Exchange server.
For msgs delivered via POP3, they're what you expect.  Mostly.





More information about the Python-list mailing list