Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

80040154 Class not registered ERROR in Outlook 2010 Add In

I am using Visual Studio 2010 to create a Outlook 2010 Add In. I try to create a new Outlook AppointmentItem to work with thinking that I can add it to the calendar eventually.

Microsoft.Office.Interop.Outlook.AppointmentItem tempApp = new Microsoft.Office.Interop.Outlook.AppointmentItem();

But when the AddIn runs and trys to create the AppointmentItem object, I get this error on the line above.

System.Runtime.InteropServices.COMException was unhandled by user code
      Message=Retrieving the COM class factory for component with CLSID {00061030-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
      Source=mscorlib
      ErrorCode=-2147221164

What can I do to "register the class"? I'm guessing it has to do with Microsoft.Office.Interop.Outlook.dll in some way.

like image 538
kavun Avatar asked Feb 23 '23 14:02

kavun


1 Answers

The exception message is not very helpful, they could have done a better job with the COM declaration. This is by design, the class is not registered. You must create an instance of it with the Application.CreateItem() method.

like image 65
Hans Passant Avatar answered Mar 07 '23 22:03

Hans Passant