1
votes

When I try to initialize object as:

   OutlookEMail email = new OutlookEMail(MailType);

in C# I get exception:

Unable to cast COM object of type 'Microsoft.Office.Interop.Outlook.ApplicationClass' to interface type 'Microsoft.Office.Interop.Outlook._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{00063001-0000-0000-C000-000000000046}' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).

Using Microsoft Office (outlook) 2007. can someone help to resolve that?

1
It looks like you are missing a DLL, or it's the wrong format for your system.AlG
Check out the documentation for ApplicationClass it should helpAlG
The documentation (usually!) lists the DLL that the class is contained in.AlG

1 Answers

0
votes

I was having this exact same error, only it was when I ran the most simple line of code:

var outlookApp = new Microsoft.Office.Interop.Outlook.Application();

I tried various fixes proposed like running a "repair" and registering various components. The fix was to change my project target from "Any CPU" to "x86". I am running Windows 8.1 64-bit with 32-bit Office.