List user's folders in Office 365 via PowerShell when Get-MailboxFolder does not work

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...

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 | 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.

Keep This Useful

Spotted something outdated or unclear?

If a step has changed, a screenshot no longer matches, or something here just does not work the way it should, get in touch and we will take a look.