Command to get list of Outlook folders


The PowerShell script posted here by staggerlee011 on SQL Notes From The Underground can be used to generate a list of folders in an Outlook profile.

First connect to Outlook:

$Outlook = New-Object -ComObject Outlook.Application

Then enter two more commands to generate the list:

$Outlook.Session.Folders.Item(1).Folders

$OutlookFolders | ft FolderPath