Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This sample code for Outlook 2003 will loop through the high level mailboxes and print certain properties to the Immediate Window. I chose the properties that looked most useful based on your request.</p> <pre><code>Sub LoopThruMailboxes() Dim olApp As Outlook.Application Dim olNS As Outlook.NameSpace Dim mailboxCount As Long Dim i As Long Dim folder As Outlook.MAPIFolder ' get local namespace Set olApp = Outlook.Application Set olNS = olApp.GetNamespace("MAPI") mailboxCount = olNS.Folders.count For i = 1 To mailboxCount Set folder = olNS.Folders(i) Debug.Print folder.EntryID Debug.Print folder.StoreID Debug.Print folder.Name Debug.Print folder.FolderPath Next i End Sub </code></pre> <p><strong>folder.Name</strong> is the name of the mailbox, <strong>folder.StoreID</strong> is the store ID (I'm not sure what you meant by "store file path", I didn't see anything that looked relevant anyway). </p> <p>Here's a functionized version that returns folder name and store ID as an array, which you could assign directly to a listbox:</p> <pre><code>Function GetMailBoxInfo() As String() Dim olApp As Outlook.Application Dim olNS As Outlook.NameSpace Dim mailboxCount As Long Dim i As Long Dim folder As Outlook.MAPIFolder Dim tempString() As String ' get local namespace Set olApp = Outlook.Application Set olNS = olApp.GetNamespace("MAPI") mailboxCount = olNS.Folders.count ' size array accordingly ReDim tempString(1 To mailboxCount, 1 To 2) For i = 1 To mailboxCount Set folder = olNS.Folders(i) tempString(i, 1) = folder.Name tempString(i, 2) = folder.StoreID Next i GetMailBoxInfo = tempString End Function </code></pre> <p>ex:</p> <pre><code>ListBox1.List = GetMailBoxInfo </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload