MapiProperty of Contact changes value after adding to PST

Thanks, I’ve also tried the following for a MapiContact Item. It appears my the tag I created has the incorrect value? or has been overwritten. Am I missing something?

private static void Main(string[] args) {
string id = “thisismyid”;
MapiMessage mapi1 = new MapiMessage();
long tag = mapi1.NamedPropertyMapping.GetNextAvailablePropertyId(MapiPropertyType.PT_UNICODE);
MapiProperty property = new MapiProperty(tag, Encoding.Unicode.GetBytes(id));
if (!File.Exists(_pstPath)) {
using (PersonalStorage pst = PersonalStorage.Create(_pstPath, FileFormatVersion.Unicode)) {
FolderInfo folder = pst.CreatePredefinedFolder(“Contacts”, StandardIpmFolder.Contacts);
Console.WriteLine(folder.EntryIdString);
AddFolder(mapi1, tag, property, pst);
ReadFolder(mapi1, tag, property, pst);
}
} else {
using (PersonalStorage pst = PersonalStorage.FromFile(_pstPath)) {
ReadFolder(mapi1, tag, property, pst);
}
}
Console.ReadKey();
}

private static void ReadFolder(MapiMessage mapi1, long tag, MapiProperty property, PersonalStorage pst) {
FolderInfo folderInfo = pst.RootFolder.GetSubFolder(“Contacts”);
FolderInfo subFolderInfo = folderInfo.GetSubFolder(“Sub Folder”);
MessageInfoCollection coll = subFolderInfo.GetContents();
Console.WriteLine(“TAG : " + tag);
foreach (MessageInfo messageInfo in coll) {
MapiContact contact = (MapiContact)pst.ExtractMessage(messageInfo).ToMapiMessageItem();
foreach (DictionaryEntry entry in contact.Properties) {
Console.WriteLine(entry.Key + “|” + entry.Value);
}
}
Console.WriteLine(Environment.NewLine);
}

private static void AddFolder(MapiMessage mapi1, long tag, MapiProperty property, PersonalStorage pst) {
mapi1.AddCustomProperty(property, “StringProp”);
FolderInfo folderInfo = pst.RootFolder.GetSubFolder(“Contacts”);
FolderInfo subFolderInfo = folderInfo.GetSubFolder(“Sub Folder”);
if (subFolderInfo == null) {
subFolderInfo = folderInfo.AddSubFolder(“Sub Folder”, “IPF.Contact”);
}
MapiContact contact1 = new MapiContact(“Sebastian Wright”, "SebastianWright@dayrep.com”);
contact1.SetProperty(property);
subFolderInfo.AddMapiMessageItem(contact1);
Console.WriteLine(Environment.NewLine);
}

Hi Ashley,


Thank you for posting your query.

We were able to reproduce this issue at our end and have logged it as EMAILNET-34935 in our bug tracking system. Our product team will investigate this issue further for a fix and we shall update you here as soon as some information is available about this problem.