Outlook Folder List (Updated)

Again, I needed to find the path to particular folder. This one was deep and not under my Inbox. So, updated the folder list function. It is now recursive and (very simply) shows the structure.

' Copyright under GPL by Mark Grimes
' list folders by poping up msg box windows
Sub ListFolders()
    Dim objNS As NameSpace
    Dim objFolder

    Set objNS = Application.GetNamespace("MAPI")
    ListFromFolder objNS, ""
    Set objNS = Nothing
End Sub

Sub ListFromFolder(objFolderRoot, spaces As String)
    Dim objFolder As MAPIFolder

    For Each objFolder In objFolderRoot.Folders
        Debug.Print spaces + objFolder.Name
        If objFolder.Folders.count > 0 Then
            ListFromFolder objFolder, spaces + " "
        End If
End Sub


September 22, 2008 8:00PM


The contents of this blog are licensed under the Creative Commons “Attribution-Noncommercial-Share Alike 3.0″ license.