Search notes:

Outlook VBA: Show folder tree

The following example iterates over all store objects found in a session and iterates over the store's The folder hierarchy.
option explicit

sub main() ' {

    dim str as outlook.store

    for each str in application.session.stores
        dim rootFld as folder
        set rootFld = str.getRootFolder
        debug.print  str.filePath
        recurseFolder rootFld, 1

    next str

end sub ' }

sub recurseFolder(byVal fldParent as outlook.folder, byVal lvl as long) ' {

    debug.print string(lvl*2, " ") & fldParent.folderPath & " (" & fldParent.name & ")"

    dim fldChild as outlook.folder
    for each fldChild in fldParent.folders
        recurseFolder fldChild, lvl+1
    next fldChild

end sub ' }
Github repository about-MS-Office-object-model, path: /Outlook/Folder/folder-tree.vb

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Microsof...', 1759408302, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Microsoft/Office/Outlook/Object-Model/Folder/tree(61): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78