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 821183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T02:36:02+00:00 2026-05-15T02:36:02+00:00

I have some code that locates all the contact folders that a user has

  • 0

I have some code that locates all the contact folders that a user has access to by iterating through the Application.Session.Stores collection.

This works for the user’s contacts and also all the public contacts folders. It also finds all the contacts folders in additional mailbox accounts that the user has added via the Tools -> Account Settings… menu command.

However, this requires the user to have full access to the other person’s account. When a user only has access to another person’s contacts, then that person’s contacts show up under the “People’s Contacts” group in the Contacts view. How do I find those contact folders that don’t show up under Session.Stores?

In order to see the other user’s contacts folder without adding access to their full mailbox, click File -> Open -> Other User’s Folder… from the Outlook menu. In the dialog box, enter the other user’s name and select Contacts from the Folder type drop down list.

Here’s the code (minus the error checking and logging) I’m using to find a list of all the user’s Outlook contact folders. I know this can (and maybe should) be done using early binding to the Outlook.Application type, but that doesn’t affect the results. EnumerateFolders is recursive so that it searches all sub folders.

Dim folderList = New Dictionary(Of String, String)
Dim outlookApp = CreateObject(Class:="Outlook.Application")
For Each store As Object In outlookApp.Session.Stores
    EnumerateFolders(folderList, store.GetRootFolder)
Next

Private Sub EnumerateFolders(ByRef folderList As Dictionary(Of String, String), ByVal folder As Object)
    Try
        If folder.DefaultItemType = 2 Then
            folderList.Add(folder.EntryID, folder.FolderPath.Substring(2))
        End If

        For Each subFolder As Object In folder.Folders
            EnumerateFolders(folderList, subFolder)
        Next
    Catch ex As Exception

    End Try
End Sub
  • 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-15T02:36:02+00:00Added an answer on May 15, 2026 at 2:36 am

    Since I didn’t get any answers here, (actually earned the Tumbleweed badge for this one) I asked this question over on the msdn forums.

    http://social.msdn.microsoft.com/Forums/en-US/outlookdev/thread/9edb0bdf-a7cb-451b-b1b4-99c6ec1f8214/

    Here’s the answer:

    In Outlook 2007 or later, go through the navigation pane. For an overview, see http://msdn.microsoft.com/en-us/library/bb206757.aspx. The sample at http://msdn.microsoft.com/en-us/library/bb176429.aspx shows how to iterate all the navigation groups within the Calendar module. Each NavigationFolder has a Folder object property that returns the actual Folder from the other user’s mailbox (or other store).

    That will get you all the folders the user is actively working with. If you want all folders they theoretically have access to, you can iterate the entries in the GAL and for each one, attempt to execute Namespace.GetSharedDefaultFolder. If the folder can’t be returned, the user doesn’t have access.

    Now that I’ve seen this, I think I’m going to use the ContactsModule for finding all the contact folders instead of searching for contacts folders within all the folders in the store. Should be much faster.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.