Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting/Creating an Outlook Application in Windows 7

I'm trying to get the current running version of Outlook or start up Outlook in case it is not running, but I am having some issues in getting or creating the Outlook Application object in Windows 7. I think it has something to do with the user priviliges that are restrictive in Vista and 7. I am working with Outlook 2010.

edit: These errors only appear if I already have an Outlook 2010 instance started. If Outlook is not started, the application can run smoothly (it can start an Outlook instance by itself).

If anybody can tell me how to correctly get the Outlook Application version, that would be really helpful.

The code I'm running is a long try-catch block that keeps on triggering exceptions:


try
{
  // create an application instance of Outlook
  oApp = new Microsoft.Office.Interop.Outlook.Application();
}
catch(System.Exception ex)
{
  try
  {
     // get Outlook in another way
     oApp = Marshal.GetActiveObject("Outlook.Application") as Microsoft.Office.Interop.Outlook.Application;
  }
  catch (System.Exception ex2)
  {
     // try some other way to get the object
     oApp = Activator.CreateInstance(Type.GetTypeFromProgID("Outlook.Application")) as Microsoft.Office.Interop.Outlook.Application;
  }
}

The application throws me the following exceptions:

When I try to create a new Outlook application instance:

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.

When I try to get the Outlook app instance:

Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))

When I try to Create an instance through the Activator

Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.

Thank you!

like image 847
Alex Avatar asked Sep 20 '10 10:09

Alex


People also ask

Is Outlook still supported for Windows 7?

Support for Windows 7 ended on January 14, 2020. Even though Windows 7 is no longer supported, we've decided to continue to provide you with security updates for Microsoft 365 for the next 3 years, until January 2023.

Can we install Outlook in Windows 7?

Outlook 2013 (Click-to-Run or MSI) on Windows 7You need to create a Microsoft Outlook profile. In Microsoft Windows, go to the Control Panel and open Mail. Click Show Profiles, and then click Add. Cannot start Microsoft Outlook.

Where is Outlook exe in Windows 7?

As we all know Outlook comes as a part of the Microsoft Office suite or Microsoft Office 365 suite. Microsoft Office applications are usually present in C:\Program Files\Microsoft Office or C:\Program Files (x86)\Microsoft Office directory. However, the exact location might differ in certain cases.


2 Answers

Apparently these errors were triggered because I was running Outlook and the application on different user permission levels (one of them as administrator and the other one as regular user).

like image 185
Alex Avatar answered Sep 30 '22 17:09

Alex


  1. In start menu select Run
  2. Type dcomcnfg and click OK
  3. Component Services window is opened.
  4. Expand the nodes Component Services -> MyComputer -> DCOM Config .
  5. Right click on the application (Outlook Message Attachment) and select properties.
  6. Click on Identity tab whatever necessary.
  7. Click on “The interactive user" then OK
like image 27
Moustafa Avatar answered Sep 30 '22 19:09

Moustafa