[Aspose.Email] Convert EML from OST file

Hey,

I get an error EML file when i when i want to convert to EML from the OST file.
What can i do ?

N:Úß?Ò»Žêoj_5—%Ö©;k ì™K`aD+uu~ˆTŠ/XPŠRôGò]´¸ÔfØ”&}/FxJ°»ÍKJj²eµy’VW¹Z12]Ïý™5z¡¨Í¾U52YÊÔyü³ÌHiº ¿k¤è|“´ÃIbª±Ü4õ¨ºp÷÷‰eÍüê
«2—©j¤Sqcˆ$fŠÞÈÓ,×S9KÉìž«V™¥½¯dʺQjVš2s΢^œ%~EÌ&YT߶x8“È•öZôÝiŒuû¬tæ•ÚN¿L¹¾â›»el8°áÀ9°ýÏ^ûI$Ýõî9ƃq¿0Yà[MAœf ·÷övö·

static void Main(string[] args)
{
try
{
Console.WriteLine(“Loading PST file…”);

// load the Outlook PST file

PersonalStorage pst = PersonalStorage.FromFile(@“C:\wksm\test.ost”);

// get the Display Name of the PST file

Console.WriteLine(“Display Name: " + pst.DisplayName);

// get the folders and messages information

FolderInfo folderInfo = pst.RootFolder;
// call the recursive method to display the folder contents
DisplayFolderContents(folderInfo, pst);
}

catch (Exception ex)
{

Console.WriteLine(ex.Message);

Debug.WriteLine(ex.Message);

}

Console.WriteLine(“Press any key to exit…”);

Console.ReadKey();

}



///

/// This is a recursive method to display contents of a folder

///


///

///

private static void DisplayFolderContents(FolderInfo folderInfo, PersonalStorage pst)
{
MessageInfoCollection messageInfoCollection = folderInfo.GetContents();

if (folderInfo.DisplayName == “xdays”)
{
foreach (MessageInfo messageInfo in messageInfoCollection)
{
if (messageInfo.Subject == “RE: test_Aspose”)
{

MapiMessage message = pst.ExtractMessage(messageInfo);
// save this message to disk in EML format
message.Save(message.Subject.Replace(”:”, " ") + “.eml”);
}
}
}

// call this method recursively for each subfolder

if (folderInfo.HasSubFolders == true)
{
foreach (FolderInfo subfolderInfo in folderInfo.GetSubFolders())
{
DisplayFolderContents(subfolderInfo, pst);
}

}
}


I found the solution


MapiMessage message = pst.ExtractMessage(messageInfo);

MailMessageInterpretor mi = MailMessageInterpretorFactory.Instance.GetIntepretor(message.MessageClass);

MailMessage messageMail = mi.Interpret(message);
messageMail.Save(“test.eml”, MailMessageSaveType.EmlFormat);