-
-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
String Named Property #133
Comments
It will handle named and unnamed properties You need this method for named properties #region AddNamedProperty
/// <summary>
/// Adds a custom named property to the message or replaces it when it already exists
/// </summary>
/// <param name="namedProperty"><see cref="NamedPropertyTag"/></param>
/// <param name="value">The value of the property</param>
/// <exception cref="MKMessageSaved">Raised when the message has already been saved with the Save method</exception>
public void AddProperty(NamedPropertyTag namedProperty, object value)
{
if (_saved)
throw new MKMessageSaved("The message can't be modified when it already has been saved");
NamedProperties.AddProperty(namedProperty, value);
}
#endregion |
Named properties only get an ID in the 0x8000 range when they are put inside the MSG file. These id's are generated when the property is put into the MSG file |
Hello Sicos, For example, in the spec we see that it's handled differently but the code in msgkit never refer to the second equation :
For me the call you are refering to is targeting a property kind=Lid and not Name.
==> Kind = PropertyKind.Lid |
i do agree with that. With an offset after 0x8000. But For me when you specify a PropertyName and a PropertyID=0x0000 , the name will never be used when written to the stream. Cause if you add a new Named PropertyTag like you did for the PidLiBilling it will not work. |
I need to look into this, I don't know if I ever did something with both kind types. |
This is how I read it: For numerical named properties, the following equation is used: Stream ID = 0x1000 + ((ID XOR (GUID index << 1))) MOD 0x1F This are the old properties below the 0x8000 range For string named properties, the following equation is used: Stream ID = 0x1000 + ((ID XOR (GUID index << 1 |1))) MOD 0x1F This are the named properties in the 0x8000 range But I can be wrong because it is a long time ago when I build this. It would be nice to have an example MSG file so that I can look into it with Outlook Spy. It is probably also better so that we understand each other and don't think that we are talking about the same but mean something else :-) |
Hello Sicos, Thanks again for your time and answers above. What you are refering to here above about old and new properties, i m well aware, it's tagged properties before 0x8000 and the named properties above 0x8000. Here i am well talking about named with as you say an incremental ID, but a property with Kind=mnid_string. For your info, the goal is to be able to use the outlook AIP plugin on emails, showing the sensitivity label (Public,Private,Secret,...), so when i generated a .msg with MsgKit i would like to add the property. i would like to help you to enhance the library with this functionality about string name properties, but i have to admit that i am a little bit lost in the logic with the streams and the mapping properties. :-) Do not hesitate to contact me if we have to dig into it together :-) Kind Regards. |
I have to do some reading about how all this works, it already took me an awful lot of reading to even understand how the MSG format works and translate that to a C# library that can be used by other software programmers. The documentation is good but the problem is understanding what somebody means in the documentation. It was a lot of trial and error before I got a working library. And I was the first one doing it in C# open source so I had no other places where I could "borrow" some code... |
I totally understand and the work you did is awesome. It works very good, thanks for the community. |
I'll try to look into it further this weekend... during the week I also have my day job that also involves in a lot of programming |
Hello,
Am i wrong or MsgKit handle only numerical named property and not string named ?
If we take the property used by AIP (Azure Information protection) it does not have an numerical ID, it's a string ID called msip_labels.
If we add this property in NamedPropertyTags.cs like new NamedPropertyTag(0x0000,"msip_labels",new guid ("00020386....",PropertyType.PT_UNICODE) it will not work.
I see also in the code that we have no special logic for Kind==1.
According to me the code handles only numerical ID.
Do you confirm ?
The text was updated successfully, but these errors were encountered: