Outlook - attach attachment at runtime

Add-in Express™ Support Service
That's what is more important than anything else

Outlook - attach attachment at runtime
 
Alfred Dworschak




Posts: 13
Joined: 2007-03-06
dear add-in-express team,

is there a possibility to attach an attachment at runtime? User clicks a button, attachment is attached?

internal void DoItemSend2(object sender)
{

Outlook.ApplicationClass outlookApp = new Outlook.ApplicationClass();
Outlook.MailItem mailItem = outlookApp as Outlook.MailItem;
String rptSource = "c:\\test.pdf";
String attachName = "Report";
int iPosition = (int)mailItem.Body.Length + 1;
int iAttachType = (int)Outlook.OlAttachmentType.olByValue;

Outlook.Attachment oAttach = mailItem.Attachments.Add(rptSource, iAttachType, iPosition, attachName);

//mailItem.Body = mailItem.Body;


Marshal.ReleaseComObject(mailItem);

}


best regards

alfred
Posted 07 Mar, 2007 07:02:18 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Alfred.

I will develop an example for you ASAP.



P.S. Note that we take up your forum requests in the order we receive them.
Besides, it may take us some time to investigate your issue. Please be sure we will let you know as soon as the best possible solution is found.
Posted 07 Mar, 2007 08:50:06 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Alfred, please download an example here:
http://www.add-in-express.com/projects/newmessageexample.zip
Posted 07 Mar, 2007 11:10:47 Top
Alfred Dworschak




Posts: 13
Joined: 2007-03-06
sergey,

thank you very much! incredible work!

alfred
Posted 07 Mar, 2007 16:07:32 Top