How to Exclude a SharePoint Online Site from Retention Policy?
Requirement: Remove retention policy from SharePoint Online site.
Exclude a SharePoint Online site from the Retention Policy
When you create a retention policy in Microsoft 365 – SharePoint Online, it’s automatically applied to all sites within your organization. You can remove the policy if you don’t want the policy to apply to a specific site. In this article, we’ll show you how to remove a retention policy from a SharePoint Online site.
Follow these steps to exclude a site collection from the retention policy in SharePoint Online:
- Login to Microsoft 365 admin center >> Open the Compliance Admin Center (If you don’t find it, click on “All Admin Centers” on the left side menu and open the “Compliance” link)
- In Compliance Admin Center, click on “Policies” from the left-hand navigation menu bar >> Open the “Retention” link.
- Find the Retention policy which is protecting SharePoint, or there may be a rule protecting everything in Microsoft 365, depending on your settings. In my case, it’s named “Retention Policy”.
- Click on the “Edit” button from the context menu of the policy
- Click on the Next buttons to navigate to the “Locations” tab, Click on “Edit” button under “Excluded” column.
- Add the site URL in exclude list, to remove the site from the retention policy.
- Select the Sites you wish to exclude from the retention list, and click on “Done”.
- Click on Next >> Next >> and “Submit” the changes.
Wait for some time (10 to 60 min) for the policy status to turn “On – Success”. Now, try to delete any objects or even the site! This time it should proceed without any errors.
Exclude SharePoint site Collection from retention policy using PowerShell
Let’s take a look at how to exclude a particular SharePoint Online site from your retention policy using PowerShell.
#Parameter
$SiteURL = "https://crescent.sharepoint.com/sites/Marketing"
$PolicyName = "Retention Policy"
Try {
#Connect to Compliance Center through Exchange Online Module
Connect-IPPSSession
#Get the Policy
$Policy = Get-RetentionCompliancePolicy -Identity $PolicyName
If($Policy)
{
#Exclude site from Retention Policy
Set-RetentionCompliancePolicy -AddSharePointLocationException $SiteURL -Identity $Policy.Name
}
}
Catch {
write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}