How to Exclude a SharePoint Online Site from Retention Policy?

Requirement: Remove retention policy from SharePoint Online site

Exclude a SharePoint Online site from retention Policy

When you create a retention policy in Microsoft 365 – SharePoint Online, it’s automatically applied to all sites within your organization. If you don’t want the policy to apply to a specific site, you can remove it. 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.remove retention policy from sharepoint online site
  • Find the Retention policy which is protecting SharePoint, or there may be a rule protecting everything in Microsoft 365, depends on your settings. In my case, its named as “Retention Policy”.
  • Click on the “Edit” button from the context menu of the policyexclude sharepoint online site from retention policy
  • Click on Next buttons to navigate to the “Locations” tab, Click on “Edit” button under “Excluded” column.how to exclude a sharepoint online site from retention policy
  • Add the site URL in exclude list, to remove the site from the retention policy. sharepoint online delete site with retention policy
  • Select the Sites you wish to exclude from the retention list, and click on “Done”.sharepoint online site retention policy
  • Click on Next >> Next >> and “Submit” the changes.sharepoint online delete site retention policy

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
}

Salaudeen Rajack

Salaudeen Rajack - SharePoint Expert with Two decades of SharePoint Experience. Love to Share my knowledge and experience with the SharePoint community, through real-time articles!

Leave a Reply

Your email address will not be published.