MAPI - get PR_TRANSPORT_MESSAGE_HEADERS

Add-in Express™ Support Service
That's what is more important than anything else

MAPI - get PR_TRANSPORT_MESSAGE_HEADERS
Can't get PR_TRANSPORT_MESSAGE_HEADERS property from _MailItem.MAPIObject 
Emmanuel SELLIER




Posts: 16
Joined: 2016-11-23
Hi,

I have a problem (it seems to be only on Oulook 2007 and older versions).

I'd like to get the Transport Message Header property of an MAPI IMessage.
I use the regular "technique" calling MAPI entry points.
But when I try to get the pointer to the IProp interface, I have a pPropValue==0:

MAPI.HrGetOneProp(unk, MAPI.PR_TRANSPORT_MESSAGE_HEADERS, out pPropValue);

and then
propValue = (MAPI.SPropValue)Marshal.PtrToStructure(pPropValue, typeof(MAPI.SPropValue));



Maybe I should try with OpenProperty interface.
But I'm not very common with MAPI and can't figure out how I can do this. And I didn't find the AddinExpress.MAPI.dll in my installation.

Do you have an example with OpenProperty? Or another way to get message headers through MAPI (can't use the GetProperty method restricted to Outlook 2007 and more).

Thanks a lot
Posted 24 Nov, 2016 10:12:48 Top
Dmitry Kostochko


Add-in Express team


Posts: 2731
Joined: 2004-04-05
Hi Emmanuel,

I would suggest using the PropertyAccessor Object in Outlook 2007 and higher.

As for the HrGetOneProp function, please check what value it returns, probably this will give you some food for thought. Also, do you use unicode or ansi variant (0x007D001F or 0x007D001E) of the PR_TRANSPORT_MESSAGE_HEADERS property tag?
Posted 24 Nov, 2016 10:33:44 Top
Emmanuel SELLIER




Posts: 16
Joined: 2016-11-23
Hi Dmitry,

I know about PropertyAccessor but I'd like my add-on to be fully compatible with outlook versions prior to 2007 => PIA.
The PropertyAcessor is not available with Outlook XP and older.

What about your AddinExpress.MAPI? Is it a "wrapper" to access MAPI object interfaces? Where is the DLL?

I'll try with variant for the property tag...

Outlook Spy succeeds (of course) to get the HEADERS so should I.
I just wondered how to use GetProperty of the IProp MAPI interface.

Thanks
Posted 24 Nov, 2016 10:50:32 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Hello Emmanuel,

You can use MAPI Store Accessor to achieve this; see https://www.add-in-express.com/downloads/mapi-store-events.php. Note that this product is outdated and it isn't supported any longer. Alternatively, you can use Outlook Redemption.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Nov, 2016 09:44:30 Top
Emmanuel SELLIER




Posts: 16
Joined: 2016-11-23
Hello Andrei,

Thanks for your reply.

Actually I did use Redemption which does it much more efficiently than I would.
Now all works fine!
Posted 25 Nov, 2016 09:49:34 Top
Andrei Smolin


Add-in Express team


Posts: 14094
Joined: 2006-05-11
Congratulations! ))

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Nov, 2016 09:54:55 Top