I am developing Outlook 2013 Addin.
My scenario:
Get email data of selected email from outlook mail window
Create new email item
Update new email item with the email data from selected email
send email
If i am selecting email without attachments and do the operation , then it is working fine.
But if selected email has attachments, then i am getting error Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
To get Selected email data, i am using below code
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;
}
}
To Send new email with attachments i am using below code.
And i am getting below Error .
Can any one please help me.?
Attachments.Add can only take a string with the file name or another Outlook item (MailItem, XContactItem, etc.). It does not take an instance of Attachments object as an argument.
If you want to copy attachments from one message to another, save then as files first, then pass the attachment file name as the parameter.
User contributions licensed under CC BY-SA 3.0