title: Reading Outlook Mail with C#
body: <p>I am using the following code as I attempt to connect to my Outlook mail. Now, I must be doing something wrong because I try to get the inbox mails and I always get 0 mails (when this is not the case). This is my code</p>
  
  <pre><code> Microsoft.Office.Interop.Outlook.NameSpace nameSpace = application.GetNamespace("MAPI");
   nameSpace.Logon("", "", Missing.Value, Missing.Value);
  
   inboxFolder = nameSpace.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);
   Console.WriteLine("Folders: {0}", inboxFolder.Folders.Count);
  </code></pre>
  
  <p>I have several email accounts in my Outlook profile. When I write the following</p>
  
  <pre><code>Console.WriteLine("Accounts: {0}",nameSpace.Accounts.Count);
  Console.WriteLine("Name: {0}", nameSpace.Accounts[1].DisplayName);
  </code></pre>
  
  <p>The total number of accounts is displayed correctly, and so is the name of the account i really want to access (index 1). Now, the problem is that I need to access a specific folder within that account. How do I do this?</p>