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:

  1. 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)
  2. 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
  3. 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”.
  4. Click on the “Edit” button from the context menu of the policyexclude sharepoint online site from retention policy
  5. Click on the Next buttons to navigate to the “Locations” tab, Click on “Edit” button under “Excluded” to exclude a sharepoint online site from retention policy
  6. Add the site URL in exclude list, to remove the site from the retention policy. sharepoint online delete site with retention policy
  7. Select the Sites you wish to exclude from the retention list, and click on “Done”.sharepoint online site retention policy
  8. 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.

$SiteURL = ""
$PolicyName = "Retention Policy"

Try {
    #Connect to Compliance Center through Exchange Online Module

    #Get the Policy
    $Policy = Get-RetentionCompliancePolicy -Identity $PolicyName

        #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!

One thought on “How to Exclude a SharePoint Online Site from Retention Policy?

  • Many thanks for posting the PS code to do this!
    The interface method is horrendous and so unintuitive, even by Microsoft standards. It’s also another fine example of MS not bothering to design to enterprise scale – the panel only load 100 SharePoint sites/M365 Groups (total!!) and the search only uses the displayed list. Seriously poor.


Leave a Reply

Your email address will not be published. Required fields are marked *