Hello, I am trying to write custom properties to an .msg file using Aspose.Network that I could read from within an Outlook add-in using the Outlook object model. My code is based on this post http://www.aspose.com/community/forums/2/275051/custom-properties-in-an-outlook-form/showthread.aspx.
Using this code I get an error trying to open the message from Outlook, a dialog window opens that says 'Cannot read the item.' This error happens on machines that do not have our Outlook add-in installed, and if I remove the code for adding custom properties the msg file opens correctly, so I think the problem is in that code.
Here is the code I am using to write a custom property -
MapiPropertyCollection namedProperties = message.NamedProperties;
MapiNamedPropertyMappingStorage mappingStorage = message.NamedPropertyMapping;
Guid PS_MAPI = Guid.NewGuid();
Guid PS_PUBLIC_STRINGS = Guid.NewGuid();
MapiProperty stringProperty = new MapiProperty(mappingStorage.GetNextAvailablePropertyId(MapiPropertyType.PT_LONG), Encoding.Unicode.GetBytes(fileInfo.FileId.ToString()));
message.SetProperty(stringProperty);
string stringNameId = "fileInfo";
mappingStorage.AddNamedPropertyMapping(stringProperty, stringNameId, PS_PUBLIC_STRINGS);
Is there another way that I should be doing this? I am using Aspose.Network version 6.7.
Thanks,
Aaron