Custom MAPI Property Displays Junk Characters

Hi,

I’m trying to add custom MAPI properties with fixed/pre-defined tagnum’s to a message. After adding the property, when we view it in OutlookSpy, it displays junk characters. When we select OpenProperty from OutlookSpy, we see that the property value displays properly. What might be causing the issue? Please provide any hints.

asp_java_email.7z (43.1 KB)

@sgdokku

We need to further investigate the issue on our end and a ticket with ID EMAILJAVA-34913 has been created to further investigate and resolve the issue. This thread has been linked with the exception so that you may be notified once the issue will be fixed.

Hi,

If you can confirm whether the issue exists and also an ETA, if confirmed that this is an issue, then we can plan our activities accordingly on our side.

Regards,
sgdokku

@sgdokku

The issue has just been created and is pending for investigation in issues queue. We request for your patience and will share the good news with you as soon as the issue will be fixed.

I figured out that we should use Sixteen-bit UCS Transformation Format, little-endian byte order when trying to set the property value. Can you confirm the same?

@sgdokku

We need to evaluate this and I have added the information in our issue tracking system for this. We will share feedback with you as soon as the issue will be addressed.

@sgdokku,
Our development team investigated the issue.

Yes, you need to use UTF-16LE (little-endian) encoding as shown below:

public boolean addMessageAttrToMessage(MapiMessage mapiMessage) throws UnsupportedEncodingException {

    long propertyTag = genPropTag(0, MapiPropertyType.PT_UNICODE);
    MapiProperty propDocID = new MapiProperty(propertyTag, "1".getBytes("utf-16le"));
    mapiMessage.setProperty(propDocID);

    propertyTag = genPropTag(1, MapiPropertyType.PT_UNICODE);
    MapiProperty propX_Zantaz_Recip = new MapiProperty(propertyTag, 
            "user1@dummydomain.net, user2@dummydomain.net".getBytes(StandardCharsets.UTF_16LE));
    mapiMessage.setProperty(propX_Zantaz_Recip);

    return true;
}

Thanks for the confirmation. Apologies for the delayed reply as we were busy trying other features of Aspose.

@sgdokku,
Thank you for your feedback.