Occasionally I need to list all the folder names in someone’s mailbox in Office 365 via PowerShell.
Microsoft have a cmdlet called Get-MailboxFolder however this only runs on the mailbox of the currently logged-in user.
Instead, try this:
Get-MailboxFolderStatistics -Identity <username> | Select FolderPath
This will give you a list of all the folders in the given user’s mailbox.
And, as a side note, this user that I needed to run this command on had no less than 24,800 folders in their inbox. Yes, really, nearly 25k folders. Some of the folder names were short stories in their own right.