This project has moved. For the latest updates, please go here.

Create Outlook MailItem from Template

Jun 26, 2013 at 12:26 PM
Edited Jun 26, 2013 at 12:26 PM

i have problems creating a mailitem loaded from mail template (eg. .oft or .msg extension) within an Outlook addin. The goal of this addin is that the user selects an predefined template and can then select a customer from a database to fill up some values.

This is the code i try to use:

// let the user select the template
if (openFileDialog1.ShowDialog() == DialogResult.OK)
// create a new MailItem.
Outlook.MailItem mailItem = Addin.Application.CreateItemFromTemplate(LastTemplateName) as Outlook.MailItem;

 * here comes the code to replace the placeholders with values from the database

When i debug this snipped i got "Vorgang abgebrochen (Ausnahme von HRESULT: 0x80004004 (E_ABORT))" errors.

What me drive totaly crazy, this snipped worked three weeks ago without any problems.

Any idea what happend here?

Marked as answer by elpado on 1/10/2014 at 6:02 AM