Reading Outlook PidNameContentType with Redemption.MAPIUtils.HrGetOneProp

18 Views Asked by At

I'm using Redemption.MAPIUtils to read the content of the extended property PidNameContentType in an Outlook 2016 Email object.

This is my code:

Redemption.MAPIUtils MAPIUtils_l = new Redemption.MAPIUtils();
int ContentTypeTag_l = unchecked((int)0x8063001F);  
string Content_l;
Content_l = MAPIUtils_l.HrGetOneProp(NewMail_l.MAPIOBJECT, ContentTypeTag_l);

With this code I read the same content as OutlookSpy. OutlookSpy_Content

If I run the code in a Outlook 365 environment, the content is always empty. But OutlookSpy does show me exactly the same information.

What in my code do I have to change to read the value of PIDNameContentType in Outlook 365?

many regards Andreas

1

There are 1 best solutions below

2
Dmitry Streblechenko On BEST ANSWER

You are hardcoding a named property tag (0x8063001F) - it will only be valid in the mailbox the screenshot comes from from. You need to call MAPIUtils_l.GetIdsFromNames passing the GUID and the string id, "or" the returned value with 0x001F (PT_UNICODE), and only then use that tag to call HrGetOneProp.

Or you can use the DASL property name (OutlookSpy shows it) abd pass it to RDOMail.Fields[] in Redemption or MailItem.PropertyAccessor.GetProperty in OOM.