Our thinking


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

1 thought on “List user’s folders in Office 365 via PowerShell when Get-MailboxFolder does not work

  1. And, to extend this, if you want to know how many folders there are, pipe the output to Measure-Object – e.g:

    Get-MailboxFolderStatistics -Identity kai | Select FolderPath | Measure-Object

    I ran this on one user’s mailbox who was having sync problems in Outlook. Yeah, there were 28,000 folders. No, not 28,000 items, 28k folders. After some cleaning up, it’s now down to just under 11k folders.

Leave a Reply to Kai HowellsCancel reply