Purpose of MapiMessage.FromProperties

Hi,

Can any one giv me an example of mapiMessage.FromProperties?

Hi Cornelius,

Thank you for writing to us.

Very often you may face the scenario where the attachment to an email is another MSG, in which case you can use the MapiMessage.FromProperties to retreive the attachment message. Please have a look at the following code sample for your reference:

Sample Code:

string dir = @"EMAIL_504023\";

MapiMessage mapi = MapiMessage.FromFile(dir + "TestEmbeddedMsg.msg");
MapiAttachment attachment = mapi.Attachments[0];

if (mapi.Attachments[0].ObjectData.IsOutlookMessage)
{
    MapiMessage attMsg = MapiMessage.FromProperties(attachment.ObjectData.Properties);
    Console.WriteLine("From: " + attMsg.SenderEmailAddress);
    Console.WriteLine("Subject:" + attMsg.Subject);
}