Reading Outlook .msg file using Python
john106henry at hotmail.com
Tue Oct 19 23:48:31 CEST 2010
On Oct 17, 4:45 am, Tim Golden <t... at westpark-club.org.uk> wrote:
> On 17/10/2010 6:39 AM, John Henry wrote:
> > On Oct 12, 10:31 am, Tim Golden<m... at timgolden.me.uk> wrote:
> >> On 12/10/2010 4:59 PM, John Henry wrote:
> >>> According to:
> >>> I need to reset my Outlook registry keys. Unfortunately, I don't have
> >>> my Office Install CD with me. This would have to wait.
> >> Thanks for the information; I'm keen to see if you're able
> >> to use the solution I posted once this fix is in place.
> >> TJG
> > Okay, after fixing the Outlook reg entries as described above, I am
> > able to go further. Now, the code stops at:
> > message = mapi.OpenIMsgOnIStg (mapi_session, None, storage, None, 0,
> > mapi.MAPI_UNICODE)
> > with an error message:
> > pywintypes.com_error: (-2147221242, 'OLE error 0x80040106', None,
> > None)
> Strange. That's UNKNOWN_FLAGS. Try the call without the MAPI_UNICODE,
> ie make the last param zero. Maybe there's something with Outlook 2002...
> I've never tried it myself.
Looks like this flag is valid only if you are getting messages
directly from Outlook. When reading the msg file, the flag is
Same issue when accessing attachments. In addition, the MAPITable
method does not seem to work at all when trying to get attachments out
of the msg file (works when dealing with message in an Outlook
mailbox). Eitherway, the display_name doesn't work when trying to
display the filename of the attachment.
I was able to get the date by using the PR_TRANSPORT_MESSAGE_HEADERS
More information about the Python-list