Not able to retrieve MapiPropertyTag.PR_HTML (0x10130102) Mapi property from MapiMessage

Consider a MapiMessage object from a PST exported from Outlook. The message body is of type html. If I try to read the mapi property 0x10130102 PidTagBodyHtml using
mapiMessage.getPropertyBytes(MapiPropertyTag.PR_HTML)
it returns a byte array.

If the same message was exported using Aspose api to a PST and the MapiMessage object was read from this exported PST, the api
mapiMessage.getPropertyBytes(MapiPropertyTag.PR_HTML)
returns null.

As a result, the body of the message in the PST is not available when viewed using Kernel outlook PST viewer. [In, outlook the message body looks fine.]

Kindly update on this behavior.

@nandhini.r.17.96,

Can you please share source files along with sample project with us so that we may further investigate to help you out.

@Adnan.Ahmad
https://drive.google.com/open?id=152yduZi_s5WY4N82EutwDKOxsRUC7dHI

@nandhini.r.17.96,

I have observed the issue shared by you and have created an investigation ticket with ID EMAILJAVA-34514 in our issue tracking system to investigate this on our end. I will share the feedback with you in this regard as soon as possible.

@Adnan.Ahmad, any update on this? We are holding up the release because of this issue.

@nandhini.r.17.96,

We have investigated this issue on our end and i like to inform that PR_HTML property is optional. To display HTML Body in an Outlook, the PR_RTF_COMPRESSED property is required. The PR_HTML is an additional property. If you need to set PR_HTML property in the MSG file, it can be set manually, via the SetProperty method. Please check following sample code to serve the purpose.

MapiMessage message = new MapiMessage();
message.Subject = “test subject”;
// set body bytes
message.SetProperty(MapiPropertyTag.PR_HTML, Encoding.Unicode.GetBytes(sampleBodyHtml));

// read body bytes from PR_HTML
byte[] body = message.GetPropertyBytes(MapiPropertyTag.PR_HTML);

Sample 2

MapiMessage message = new MapiMessage();
message.Subject = “test subject”;
// set body html string according to format
message.SetProperty(MapiPropertyTag.PR_HTML, sampleBodyHtml);

// read body bytes from PR_BODY_HTML_W
byte[] body = message.GetPropertyBytes(MapiPropertyTag.PR_BODY_HTML_W);