0

Requirement: My application has a requirement to send emails via outlook. I could accomplish this using Outlook = Microsoft.Office.Interop.Outlook;

The application works fine on development environment but iam getting an exception: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))

Detailed:

System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache)
 at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean skipCheckThis, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at InvoiceSearchTool.Controllers.emailController.CreateMessageWithAttachment(String invoiceNumber, String recipient, String messageBody) in C:\Projects\KeleInvoice\InvoiceSearchTool\Controllers\emailController.cs:line 38

I do not have outlook installed on an application server. Do I need to install outlook on a server? or the exception is for some other reason? how to get rid of it?

Zero
  • 315
  • 1
  • 5
  • 21
Mini
  • 105
  • 1
  • 3

1 Answers1

1

The CLSID for Outlook is {0006F03A-0000-0000-C000-000000000046}. As the error code suggest, it cannot find the Class. You will need to install Outlook (the same version on you have on the development should be also installed on the application server).

(ps - please tick if i am correct, thank you!)

Cold T
  • 2,391
  • 2
  • 16
  • 28
  • one doubt here... you said same version? On application server i can get the same version installed but the application will be accessed by many machines with different outlook version, will that work fine? – Mini Jan 20 '12 at 17:53
  • yes would need to be same version, as each has difference CLSID. Take a look at this thread, it explains to some extent in getting it working for various versions - http://stackoverflow.com/questions/5404615/outlook-2003-add-in-wont-load-but-is-in-working-order – Cold T Jan 20 '12 at 18:04