I'm working on Outlook VSTO project, where I have to save all attachments of an email to a specific folder. I am looping through the attachments and checking their type like this:
Outlook.Inspector currentInspector = outlookApp.ActiveInspector();
var selectedMail = currentInspector.CurrentItem as Outlook.MailItem;
foreach (Outlook.Attachment attachment in selectedMail.Attachments)
{
var attachmentType = attachment.Type; // this is "olByValue" all the time -- in case of embedded images, as well as actual attachments
}
(selectedMail.Attachments contains actual attachments, as well as embedded/pasted pictures in the body of the email).
Is there a way to distinguish an attachment from an embedded image here?
Right now the approach I'm using to filter out embedded images is to check if file is less than 20KB and is an image, exclude it. But it's not perfect as if someone actually attached an image less than 20KB to an email, this would exclude it.