IConverterSession behavior

Jun 7, 2011 at 2:04 PM

When i try to use IConverterSession ConvertMapiToMimeStm, i found that method permanently changed PR_TRANSPORT_MESSAGE_HEADERS property and original value has been lost.

I need original message header for re-assemble MIME message from MAPI and that do MapiToMimeStm completely useless for me.

Is any way to avoid this "bad" behavior ?

MAPI Outlook 2010 (x32)

Jun 7, 2011 at 3:26 PM

Are you saying PR_TRANSPORT_MESSAGE_HEADERS on the original MAPI message is overwritten and no longer present, or are you complaining about the resulting MIME that you get from MapiToMimeStm?

Jun 13, 2011 at 3:38 PM

PR_TRANSPORT_MESSAGE_HEADERS on the original message completely replaced with headers generated by MapiToMimeStm.

I know that IConverterSession not use PR_TRANSPORT_MESSAGE_HEADERS to produce MIME message. But i wonder why method change this property without any permissions.

Jun 13, 2011 at 3:41 PM

I Don't recall seeing this behavior before. What happens if you open the message read only before passing it to the API for conversion?

Jun 14, 2011 at 12:36 AM

How i can open message read-only? i have only MAPI_BEST_ACCESS flag.

IMessage inherit access permissions from parent IMAPISession -> IMsgStore -> IMAPIFolder -> IMessage

On every level i can set only MAPI_BEST_ACCESS.

MapiLogonEx also not have "Read-Only" flag

I launch MFCMapi and try to save message using IConverterSession and have same result: PR_TRANSPORT_MESSAGE_HEADERS changed after call MapiToMimeStm

Unfortunately I can not check for Outlook 2007 and lower versions.

Jun 14, 2011 at 1:36 AM

MAPI_BEST_ACCESS means "open with read/write if I have permissions, otherwise read only". MAPI_MODIFY means "open read/write, unless I don't have permission, then fail". If you don't want read/write, don't use either flag.

Jul 7, 2011 at 3:29 PM
Edited Jul 7, 2011 at 3:31 PM

Sorry for long answer.

I'm try to remove all flags at OpenMsgStore and OpenEntry but ICoverterSession still overwrite PR_TRANSPORT_MESSAGE_HEADERS

Jul 7, 2011 at 3:40 PM

I'm finding this hard to believe since it shouldn't be possible to modify a read only object. After you've gotten the message open, you should ask for PR_ACCESS_LEVEL and see what it reports. If you opened the message read only, it should be 0. If you opened it read/write, it will be 1.

Jul 7, 2011 at 5:23 PM
Edited Jul 7, 2011 at 5:34 PM

OpenMsgStore called with flags 0 has PR_STORE_SUPPORT_MASK does not contain STORE_MODIFY_OK and STORE_CREATE_OK

Opened IMessage with flags 0 has PR_ACCESS_LEVEL 1 (i.e. r/w)

Is any other way open as "read-only"?