Connect to 365 via powershell
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking.
Get–MailboxFolderstatistics –Identity mailboxname | Where {$_.Name –Match “foldername”}
For instance to search my mailbox name Matt for a folder that contains alerts the command looks like this:
PS C:\WINDOWS\system32> Get-MailboxFolderstatistics -Identity matt | Where {$_.Name -Match “alerts”}
Although this give the output below, If you have multiple folders that contain your search criteria it can be difficulty to read
To get a better idea of where the folder is located use the identity to filter
PS C:\WINDOWS\system32> Get-MailboxFolderstatistics -Identity matt | Where {$_.Name -Match “alerts”} | select identity
Identity
——–
matt\LanSweeperAlerts
Another example is a folder called backups that is within my inbox folder
PS C:\WINDOWS\system32> Get-MailboxFolderstatistics -Identity matt | Where {$_.Name -Match “backups”} | select identity
Identity
——–
matt\Inbox\Backups
Once you have finished disconnect your exchange powershell session
Remove-PSSession $Session