title: Access Outlook default folder
body: <p>I working on an Outlook VBA application and I need to access my inbox but I seem to be having some trouble. I am using the <code>GetDefaultFoldder(olFolderInbox)</code> method, however, I have several email addresses set up and none of them show up in my personal folder's inbox. </p>
  
  <p>So my question is, where is this default folder defined? How do I know which inbox is the default one? I know there is also the <code>GetFolderFromID</code> method, if I were to use this, </p>
  
  <p>how can I find a folders ID in order to point to it? </p>
  
  <p>Here is the code I am using. This is from a tutorial on Timothy Chen Allen's blog as seen here <a href="http://timothychenallen.blogspot.com/2008/08/outlook-vba-script-to-display-all.html" rel="nofollow">Timothy's Blog</a>. The code: </p>
  
  <pre><code>Sub find_unread()
      On Error GoTo eh:
      Dim ns As Outlook.NameSpace
      Dim folder As MAPIFolder
      Dim item As Object
      Dim msg As MailItem
  
      Set ns = Session.Application.GetNamespace("MAPI")
      Set folder = ns.GetDefaultFolder(olFolderInbox)
  
      For Each item In folder.Items
          DoEvents
          If (item.Class = olMail) And (item.UnRead) Then
              Set msg = item
              Debug.Print msg.SenderEmailAddress
              msg.Display True
          End If
      Next
  
      MsgBox "All messages in Inbox are read", vbInformation, "All Read"
      Exit Sub
  eh:
      MsgBox Err.Description, vbCritical, Err.Number
  End Sub
  </code></pre>