Cannot access OFT template properties using Interop.Outlook. Error 0x80004004

0

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.

c#
.net
outlook
asked on Stack Overflow Dec 21, 2020 by Joe Eftekhari • edited Dec 21, 2020 by Beso

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0