MapiMessage distinguishing between an embedded object and attachment

I have Aspose.Total and am simply trying to count the number of attachments to a given email message that i pull from a file.


MapiMessage msg = MapiMessage.FromFile(MSG.Path);

count = msg.Attachments.Count;

This is very simple and it works for the most part. My problem occurs when I want to distinguish between an embedded object in an email and an actual attachment. I’m sure the argument can be made that they are the same, but I want to know if Aspose can distinguish between the two types and if so, how.

TIA.

Hi Sir,

Thanks for considering Aspose.

We will provide you the sample shortly.

Thanks! I’ve cooked up this, but it only gets about 90 percent. I’d love something a bit more solid.



foreach (MapiAttachment attachment in msg.Attachments)
{
if (attachment.Properties.Contains(805371934)
&& ((Encoding.ASCII.GetString(attachment.Properties[805371934].Data) == “” && attachment.ObjectData == null)
|| Encoding.ASCII.GetString(attachment.Properties[805371934].Data) == “Picture (Enhanced Metafile)”
|| Encoding.ASCII.GetString(attachment.Properties[805371934].Data) == “Picture (Metafile)”
)
|| (attachment.DisplayName == “Microsoft Excel Chart” && attachment.FileName == “Untitled Attachment”)
|| (attachment.DisplayName == “StdOleLink” && attachment.FileName == “Untitled Attachment”)
|| (attachment.DisplayName == “Microsoft Office Excel Worksheet” && attachment.FileName == “Untitled Attachment”)
|| (attachment.DisplayName == null && attachment.FileName == “Untitled Attachment”)
|| (attachment.DisplayName == null && attachment.FileName == null)
)
{
//it is an embedded object not a file
count = count;
}
else
{
//it is a file
count++;
}
}
}

Hello,

For Ole attachment type, the MapiAttachment.ObjectData != null. For example, excel, word, ppt, embedded files.

If the attachment does not have ObjectData. BUT it contain the properties PR_ATTACH_CONTENT_ID
(0x3712001E) or PR_ATTACH_CONTENT_LOCATION (3713001E). It also maybe an embedded image or file.

Thanks,

How shortly is shortly?