I have the below code that I harvested from MSDN. There intent there seems to have been as an Add In and as such I am having a problem with the this.Application.CreateItem(...)
portion. What do I need to do differently to do this from my winform app?
private void AddAttachment(){
Outlook.MailItem mail =this.Application.CreateItem(Outlook.OlItemType.olMailItem)as Outlook.MailItem;
mail.Subject = "An attachment for you!";
OpenFileDialog attachment = new OpenFileDialog();
attachment.Title = "Select a file to send";
attachment.ShowDialog();
if (attachment.FileName.Length > 0)
{
mail.Attachments.Add(
attachment.FileName,
Outlook.OlAttachmentType.olByValue,
1,
attachment.FileName);
mail.Recipients.Add("Armando Pinto ");
((Outlook._MailItem)mail).Send();
}