I am opening a PST. Spinning through the folders and emails.
When I hit an email via the MessageInfo item and it has attachments, how do I determine if the attachment is an embedded email or a file?
Basic snipped I am using is below:
For Each messageInfo As MessageInfo In messageInfoCollection
Dim message As MapiMessage = personalStorage.ExtractMessage(messageInfo)
message.Save("\extracted" & message.Subject & “.msg”)
Next messageInfo
Hi Salemntulsa,
Thank you for writing to Aspose support team.
You can use the following code sample to determine if the attachment to a MapiMessage is another embedded email or not. Please try it at your end and let us know your feedback.
Sample Code:
var message = Aspose.Email.Outlook.MapiMessage.FromFile(str_path);
var attachments = message.Attachments;
foreach (var attachment in attachments)
{
if (attachment.ObjectData != null && attachment.ObjectData.IsOutlookMessage)
{
var embeddedMessage = Aspose.Email.Outlook.MapiMessage.FromStream(new System.IO.MemoryStream(attachment.ObjectData.Data));
embeddedMessage.Save(“out.msg”);
}
}