title: Creating Outlook Application Object reference not set to an instance of an object
body: <p>Hello I am creating a new Outlook.Application (with v.14.0.0.0 Office library) and retrieving the inbox email with C#. Only when outlook is not running, I am getting the error </p>
  
  <blockquote>
    <p>'Object reference not set to an instance of an object'</p>
  </blockquote>
  
  <p>in a alert(Occurred by the first line). The program is runnig ahead(doesn't even go in the catch part).</p>
  
  <pre><code>try {
      Outlook.Application outlookApplication = new Outlook.Application();
      Outlook.NameSpace mapiNameSpace = outlookApplication.GetNamespace("MAPI");
      Outlook.MAPIFolder folder = mapiNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);
  
      foreach (Object obj in folder.Items) {
          if (obj is Outlook.MailItem) {
              Outlook.MailItem mailItem = (Outlook.MailItem)obj;
          }
      }
  } catch (Exception e) {
      Console.WriteLine("Unfortunately an error occurred");
      Console.WriteLine(e.Message);
  }
  </code></pre>
  
  <p>Is there any solution for this annoying alert? Can I suppress it or fix the problem?</p>
  
  <p>The alert is coming from a Outlook instance, I can see it because in the navigation bar a outlook instance is open (the little alert dialog).</p>