Sicos1977 / MsgKit

A .NET library to make MSG files without the need for Outlook
199 stars 55 forks source link

PR_SENSITIVITY property length #89

Closed Mystercoco closed 2 years ago

Mystercoco commented 2 years ago

The property is using 4 bytes causing Outlook to crash when opening the msg file; it should be on 8 bytes instead.

A simple fix is to change the type in the file PropertyTags.cs as following (line 533)

public static PropertyTag PR_SENSITIVITY { get { return new PropertyTag(0x0036, PropertyType.PT_I8); } }
Sicos1977 commented 2 years ago

According to Microsoft it should be a long.

https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/pidtagsensitivity-canonical-property

And it is a long in code

        /// <summary>
        ///     Contains a value indicating the message sender's opinion of the sensitivity of a message.
        /// </summary>
        public static PropertyTag PR_SENSITIVITY
        {
            get { return new PropertyTag(0x0036, PropertyType.PT_LONG); }
        }

And a PT_LONG should be 4 bytes, a PT_DOUBLE is 8 bytes

https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcdata/0c77892e-288e-435a-9c49-be1c20c7afdb

So nothing to fix

Mystercoco commented 2 years ago

I had an error message when adding Sensitivity property (see screenshot below), changing the code to I8 fixed it.

After investigation, it depends on the order of properties, adding the property later in the code fixes the issue as well (with original "long" type).

20211103 Sensitivity