title: Getting/Creating an Outlook Application in Windows 7
body: <p><strong>I'm trying to get the current running version of Outlook or start up Outlook in case it is not running</strong>, 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.</p>
  
  <p><strong>edit:</strong> 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).</p>
  
  <p>If anybody can tell me how to correctly get the Outlook Application version, that would be really helpful.</p>
  
  <p>The code I'm running is a long try-catch block that keeps on triggering exceptions:</p>
  
  <pre><code>
  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;
    }
  }
  </code></pre>
  
  <p>The application throws me the following exceptions:</p>
  
  <p>When I try to create a new Outlook application instance:</p>
  
  <blockquote>
  Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.
  </blockquote>
  
  <p>When I try to get the Outlook app instance:</p>
  
  <blockquote>
  Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))
  </blockquote>
  
  <p>When I try to Create an instance through the Activator</p>
  
  <blockquote>
  Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.
  </blockquote>
  
  <p>Thank you!</p>