Hi
I am testing Aspose Network to read msg files. I am getting all MapiProperties and building string values for each. I am stuck on PT_BINARY. How do I convert those to String values. I have tried System.Convert and different Encodings. I am also doing all of this in C#.
Thanks,
Joey
This message was posted using Email2Forum by ShL77.
Hi Joey,
Thanks for considering Aspose.
You may use Encoding.GetString() kind of method similar to the below code sample:
MapiMessage message = MapiMessage.FromFile("Email.msg");
MapiPropertyCollection propColl = message.Properties;
foreach (MapiProperty mapiprop in propColl.Values)
{
if (mapiprop != null)
{
Console.WriteLine("Name: " + mapiprop.PropertyTagName + ", Type: " + mapiprop.DataType);
switch (mapiprop.DataType)
{
case (int)MapiPropertyType.PT_STRING8:
//Console.WriteLine("String value: " + mapiprop.GetString());
break;
case (int)MapiPropertyType.PT_BINARY:
Console.WriteLine("Binary value: " + System.Text.UTF8Encoding.UTF8.GetString(mapiprop.Data));
break;
default:
break;
}
}
}