Outlook – List all folders within a top level folder using VBA

List all top level folders in an Outlook mailbox using VBA

Let’s say I wanted to list all the folders for a top level folder such as LargeOldEmails2 using VBA. How would I do it?

Outlook 2010 top level folders

Outlook 2010 top level folders

 

How is this helpful? There are multiple uses for this. It helps counting the number of folders in the top level folder. Also, this helps isolate a folder of interest and do something with it, such as find how many emails it contains. It helps run statistics about email items in each folder and when was the last one created etc.