i have written below addin code to save attachments from Selected Outlook Email.
MailItem mailItem = null;
Attachments mtAttachments = null;
Explorer explorer = Globals.ThisAddIn.Application.ActiveExplorer();
if (explorer != null && explorer.Selection != null && explorer.Selection.Count > 0)
{
object item = explorer.Selection[1];
if (item is MailItem)
{
mailItem = item as MailItem;
subject = mailItem.Subject;
body = mailItem.HTMLBody;
mtAttachments = mailItem.Attachments;
if (mailItem.Attachments.Count > 0)
{
for (int j = 1; j <= mailItem
.Attachments.Count; j++)
{
mailItem.Attachments[j].SaveAsFile
(@"C:\TestFileSave\" +
mailItem.Attachments[j].FileName);
}
}
}
}
But the problem is, it is also saving images from signatures also, which is completely wrong.
I just want to save attachments of email.
can anyone please help me.?