Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6812029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:24:00+00:00 2026-05-26T20:24:00+00:00

In Outlook 2007, I am able to loop through mails stores, including PSTs, using

  • 0

In Outlook 2007, I am able to loop through mails stores, including PSTs, using code like this:

Dim stores As Outlook.stores
Set stores = objNamespace.stores
Dim store As Outlook.store

For Each store In stores
    MsgBox store.FilePath
Next

However, in Outlook 2003, the Outlook.store and Outlook.stores objects do not exist.

Are there equivalent objects in Outlook 2003?
What other method might I use to loop through mail stores?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:24:01+00:00Added an answer on May 26, 2026 at 8:24 pm

    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.

    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
    

    folder.Name is the name of the mailbox, folder.StoreID is the store ID (I’m not sure what you meant by “store file path”, I didn’t see anything that looked relevant anyway).

    Here’s a functionized version that returns folder name and store ID as an array, which you could assign directly to a listbox:

    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
    

    ex:

    ListBox1.List = GetMailBoxInfo
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to retrieve an outlook (2007) folder using something like this: Outlook.NameSpace MAPINameSpace
I've created a simple Outlook 2007 add-in using C# which loops through a selection
in my Outlook 2007 addin this code opens modal dialog box about user details
I'm trying to get the contacts from Outlook (2007) using the following code: Outlook.Application
Is there a way in Outlook 2007 to set a follow-up flag on an
How can I close any Office 2007 running application like Word,Excel,Outlook before installing an
I want to create a custom ribbon button within Outlook 2007 using Visual Studio
I'm working on a Outlook 2007 AddIn using VSTO and one of the things
Any ideas why the following code does not exit the Outlook 2007 process created
I am generating an RSS 2.0 feed using System.ServiceModel.Syndication.SyndicationFeed for Outlook 2007 SP2 clients,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.