I am trying to access the Body
property of my MailItem
object.
When I try, I get this error:
Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
After searching for this error, it seems people have this problem when trying to send the email, but not when accessing it's properties.
Here is my code.
using Outlook = Microsoft.Office.Interop.Outlook;
using OutlookApp = Microsoft.Office.Interop.Outlook.Application;
string testPath = "testPathToTemplate.oft";
/*CREATE NEW EMAIL FROM TEMPLATE*/
var OutlookApp = new OutlookApp();
Outlook.MailItem mail =
OutlookApp.CreateItemFromTemplate(testPath) as Outlook.MailItem;
/*GET EMAIL TEXT*/
string fileText = mail.Body;
The error occurs on the "mail.Body;" call.
User contributions licensed under CC BY-SA 3.0