If a mailbox is in Litigation Hold, the hold needs to be removed before mails can be removed.
Example:
GA Account: [email protected]
User’s Mailbox: [email protected]
Allocated Quota: 99GB
Current usage: 100.1GB
1. $SccSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $credential -Authentication "Basic" -AllowRedirection
2. Import-Module ExchangeOnlineManagement
3. Connect-IPPSSession -UserPrincipalName [email protected]
4. Get-ComplianceCase
5. New-ComplianceSearch -Name "UserMails" -ExchangeLocation "[email protected]"
6. Get-ComplianceSearch -Identity 'UserMails' | Format-List
7. Start-ComplianceSearch -identity "UserMails"
8. Get-ComplianceSearch
- Wait for status to be "Completed"
9. New-ComplianceSearchAction -SearchName "UserMails" -Purge -PurgeType HardDelete
10. Get-ComplianceSearchAction
- Wait for status to be "Completed"
11. Remove-ComplianceSearchAction -Identity "UserMails_Purge"
12. Each action will only remove 10 items. Repeat 9 to 11 until desired reduction of storage is accomplished.
References:
- https://www.reddit.com/r/Office365/comments/1fz7jp2/new_purview_portal_delete_messages_from_content/
- https://learn.microsoft.com/en-us/powershell/module/exchange/new-compliancesearch?view=exchange-ps
- https://learn.microsoft.com/en-us/powershell/module/exchange/new-compliancesearchaction?view=exchange-ps
- https://learn.microsoft.com/en-us/purview/ediscovery-delete-items-in-the-recoverable-items-folder-of-mailboxes-on-hold?view=o365-worldwide
- https://learn.microsoft.com/en-us/purview/ediscovery-delete-items-in-the-recoverable-items-folder-of-mailboxes-on-hold?view=o365-worldwide