Skip to content

/errors/purview/we-couldnt-find-this-location-failedtoopencontainer

Retention policy error: We couldn't find this location (FailedToOpenContainer)

The commands on this page have not been executed by our verification runner yet.updated
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:

powershell
Connect-IPPSSession -UserPrincipalName admin@contoso.com
Get-RetentionCompliancePolicy -Identity "Finance retention" -DistributionDetail |
  Select-Object -ExpandProperty DistributionResults

Each 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:

powershell
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 typeParameter
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):

powershell
$deleted = @"
[{ 'EmailAddress': 'USSales@contoso.onmicrosoft.com', 'SiteId': 'SITE_ID' }]
"@
Set-RetentionCompliancePolicy -Identity "Finance retention" -RemoveModernGroupLocation "USSales@contoso.onmicrosoft.com" -DeletedResources $deleted

Read 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 messageDistributionResults valueFix
Something went wrongPolicyNotifyErrorRetry (-RetryDistribution)
We're still processing your policyPolicySyncTimeoutRetry (-RetryDistribution)
We can't process your policyActiveDirectorySyncErrorRetry (-RetryDistribution)
The location is ambiguousMultipleInactiveRecipientsErrorMake each location resolve to one object
We ran into a problemInternalErrorRetry (-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