Problem with named properties mapping

I have problem with named properties mapping when I save messages to PST and try to open it later. Below code that shows this:

using (PersonalStorage pst = PersonalStorage.Create(@"c:\test.pst", FileFormatVersion.Unicode))
{
MapiMessage message1 = new MapiMessage();
long mapiPropertyTag1 = message1.NamedPropertyMapping.GetNextAvailablePropertyId(MapiPropertyType.PT_UNICODE);
Guid mapiPropertyGuid1 = new Guid("11000e07-b51b-40d6-af21-caa85edab1d0");
MapiProperty mapiProperty1 = new MapiProperty(mapiPropertyTag1, Encoding.Unicode.GetBytes("test"));
message1.NamedPropertyMapping.AddNamedPropertyMapping(mapiProperty1, 12, mapiPropertyGuid1);
message1.SetProperty(mapiProperty1);

MapiMessage message2 = new MapiMessage();
long mapiPropertyTag2 = message2.NamedPropertyMapping.GetNextAvailablePropertyId(MapiPropertyType.PT_DOUBLE);
Guid mapiPropertyGuid2 = new Guid("6ed8da90-450b-101b-98da-00aa003f1305");
MapiProperty mapiProperty2 = new MapiProperty(mapiPropertyTag2, BitConverter.GetBytes(123.456));
message2.NamedPropertyMapping.AddNamedPropertyMapping(mapiProperty2, 12, mapiPropertyGuid2);
message2.SetProperty(mapiProperty2);

Console.WriteLine("before save:");
foreach (MapiNamedProperty property in message1.NamedProperties.Values)
{
Console.WriteLine(property.Tag + " " + property.Guid + " " + property.ToString());
}
foreach (MapiNamedProperty property in message2.NamedProperties.Values)
{
Console.WriteLine(property.Tag + " " + property.Guid + " " + property.ToString());
}

pst.RootFolder.AddMessage(message1);
pst.RootFolder.AddMessage(message2);
}

using (PersonalStorage pst = PersonalStorage.FromFile(@"c:\test.pst"))
{
Console.WriteLine("after load:");
foreach (MapiMessage message in pst.RootFolder.EnumerateMapiMessages())
{
foreach (MapiNamedProperty property in message.NamedProperties.Values)
{
Console.WriteLine(property.Tag + " " + property.Guid + " " + property.ToString());
}
}
}

Before saved named properties have different GUIDs (correct):
2147483679 11000e07-b51b-40d6-af21-caa85edab1d0 test
2147483653 6ed8da90-450b-101b-98da-00aa003f1305 77BE9F1A2FDD5E40

and after load from PST GUIDs are same (incorrect):
2147483679 11000e07-b51b-40d6-af21-caa85edab1d0 test
2147483653 11000e07-b51b-40d6-af21-caa85edab1d0 77BE9F1A2FDD5E40

Hi Maicej,


Thank you for contacting Aspose support team.

In this sample code same nameId (12) is used for mapping both the properties. Please use different nameId like 12 and 13 as second argument while calling the AddNamedPropertyMapping() function for both properties. This will remove the error and both the GUIDs are different after loading the PST.

Please feel free to write us back for any other query about this issue.

Hi Muhammad,

Your answer doesn’t solve my problem. It is normal that name (which can be a number or a string) of the named property it’s not unique. You can read about this here: About Named Properties Used by Outlook | Microsoft Learn.

“MAPI provides a facility for assigning names to certain properties, for mapping these names to unique identifiers, and for making this name-to-identifier mapping persistent across sessions. Named properties are identified by a name and a globally unique identifier (GUID) for a property set.

Link to a screenshot from MFCMAPI program showing the situation of use of name ID 12 for two different property sets (GUIDs): http://postimg.org/image/ui10iqiu5/. So this is a bug in your software.

Hi Maicej,


I have analyzed the requirement and supporting information again and have logged it in our bug tracking system under Id:EMAILNET-34795 for further analysis by the product team. I shall write here again as soon as some feedback is received about this issue.

The issues you have found earlier (filed as EMAILNET-34795) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.