/errors/purview/we-couldnt-find-this-location-failedtoopencontainer
Retention policy error: We couldn't find this location (FailedToOpenContainer)
- tool
- Microsoft Purview (Security & Compliance PowerShell)
- versions
- Microsoft Purview, ExchangeOnlineManagement 3.x
- os
- any
We couldn't find this location is the error the Microsoft Purview portal shows in the details pane of a retention or retention label policy when one of its locations no longer exists. In PowerShell the same problem appears as FailedToOpenContainer in the policy's distribution results. Microsoft's troubleshooting article states that the system requires you to remove the problematic locations as part of your next update to the policy: remove them, then retry the distribution.
Find the failing locations
Connect to Security & Compliance PowerShell (module ExchangeOnlineManagement, Connect-IPPSSession, with a role such as Compliance Administrator) and read the distribution details:
Connect-IPPSSession -UserPrincipalName admin@contoso.com
Get-RetentionCompliancePolicy -Identity "Finance retention" -DistributionDetail |
Select-Object -ExpandProperty DistributionResultsEach result names the location and the error; the entries with FailedToOpenContainer are the locations to remove.
Remove the locations and redeploy
Use the Remove*Location parameter that matches the workload:
Set-RetentionCompliancePolicy -Identity "Finance retention" -RemoveExchangeLocation "old.user@contoso.com"
Set-RetentionCompliancePolicy -Identity "Finance retention" -RemoveSharePointLocation "https://contoso.sharepoint.com/sites/oldproject"
Set-RetentionCompliancePolicy -Identity "Finance retention" -RetryDistribution| Location type | Parameter |
|---|---|
| Exchange mailboxes | -RemoveExchangeLocation |
| SharePoint sites | -RemoveSharePointLocation |
| OneDrive accounts | -RemoveOneDriveLocation |
| Microsoft 365 groups | -RemoveModernGroupLocation |
For a deleted Microsoft 365 group, the cmdlet reference identifies the group by its email address and site ID through -DeletedResources (a JSON string):
$deleted = @"
[{ 'EmailAddress': 'USSales@contoso.onmicrosoft.com', 'SiteId': 'SITE_ID' }]
"@
Set-RetentionCompliancePolicy -Identity "Finance retention" -RemoveModernGroupLocation "USSales@contoso.onmicrosoft.com" -DeletedResources $deletedRead the caution for -DeletedResources in the cmdlet reference first: the same SMTP address can belong to another, active mailbox.
Then check DistributionStatus with Get-RetentionCompliancePolicy -Identity "Finance retention" | Select-Object Name, DistributionStatus until it is Success.
Other distribution errors
The same troubleshooting article lists the other portal messages and their DistributionResults values:
| Portal message | DistributionResults value | Fix |
|---|---|---|
| Something went wrong | PolicyNotifyError | Retry (-RetryDistribution) |
| We're still processing your policy | PolicySyncTimeout | Retry (-RetryDistribution) |
| We can't process your policy | ActiveDirectorySyncError | Retry (-RetryDistribution) |
| The location is ambiguous | MultipleInactiveRecipientsError | Make each location resolve to one object |
| We ran into a problem | InternalError | Retry (-RetryDistribution) |
A policy that cannot be deleted is a separate case: policy stuck in PendingDeletion. The retention cmdlets themselves exist only after Connect-IPPSSession; see Get-RetentionCompliancePolicy is not recognized.
Sources
- learn.microsoft.comlearn.microsoft.com/en-us/troubleshoot/microsoft-365/purview/retention/resolve-errors-in-retention-and-retention-label-policies
- learn.microsoft.comlearn.microsoft.com/en-us/troubleshoot/microsoft-365/purview/retention/identify-errors-in-retention-and-retention-label-policies
- learn.microsoft.comlearn.microsoft.com/en-us/powershell/module/exchangepowershell/set-retentioncompliancepolicy