I needed to set retention policy in SharePoint Online, but couldn’t find a simple guide that explained the steps clearly. After a thorough research, I found two reliable solutions that can easily help with this, using the Microsoft 365 Compliance Center and PowerShell. If you’re like me and want a straightforward way to get it done, this guide will explain both methods step-by-step.
If you’re new to the platform, first go through this beginner’s guide to learn more about: What is SharePoint Online?
Table of Contents
- What is the SharePoint Online Retention Policy?
- Types of Retention Options Explained
- Why Set Retention Policy in SharePoint Online?
- How to Set Retention Policy in SharePoint Online
- Method 1: Create via Admin Center
- Method 2: Set via PowerShell
- What Are Retention Labels in SharePoint Online?
- Impact of Retention Policies on SharePoint Sites
- How Retention Works Behind the Scenes
- What Happens After Data Deletion?
- Final Thoughts
- People Also Ask – Retention Policy in SharePoint Online
What is the SharePoint Online Retention Policy?
A retention policy is a rule that determines how long content is stored and what happens when that time expires. You can use it to:
- Keep content for a specified period
- Automatically delete content after that time
- Prevent users from deleting or editing documents during the retention period.
There are two primary types of retention policies:
- Static Retention Policies – Help to set the retention period for all data.
- Adaptive Retention Policies – Help to automatically change the retention period depending on different conditions.
These policies are managed through the Microsoft Purview Compliance Center and can be applied across SharePoint, OneDrive, Teams, and Exchange.
Types of Retention Options Explained
Retention Option | Description | Best For |
Retention Policy | Broad policy applied across SharePoint sites or mailboxes | Organization-wide rules |
Retention Label | Granular control over individual documents or folders | Legal, financial, or HR data |
Adaptive Policy | Uses conditions to apply retention dynamically | Large organizations with varying rules |
Why Set Retention Policy in SharePoint Online?
From my experience, here’s why setting a retention policy is essential for SharePoint management:
- Storage Optimization – Prevent SharePoint from becoming cluttered with outdated content.
- Improved Search Results – Automatically removing expired data keeps search results clean and relevant.
- Business Continuity – Ensures that important files are preserved during staff transitions or organizational changes.
How to Set Retention Policy in SharePoint Online?
After researching and experimenting, I discovered two reliable ways:
Method 1. Create a Retention Policy for SharePoint Online Via the Admin Center
Creating and applying a retention policy in SharePoint Online is easy. Ensure you have all the admin rights or SharePoint Online permissions for proceeding with the task hassle-free. Here’s a step-by-step guide:
- Log in to the Microsoft 365 Compliance Center via the app launcher.
- Go to Data Lifecycle Management > Microsoft 365 > Retention Policies.
- Click “New Retention Policy.”
- Add a name and description.
- Assign to specific administrative units (optional).
- Choose between Static or Adaptive Retention.
- Select locations – e.g., SharePoint, OneDrive, Teams.
- Set the duration (e.g., 365 days or 5 years).
- Choose whether to retain, delete, or retain, then delete.
- Review your settings and click Submit to create a retention policy for SharePoint Online.
Note: It may take up to 7 days for policies to take effect across your environment.
Method 2. Setting SharePoint Online Retention Policy via PowerShell
Those who looking for how to set retention policy in Sharepoint Online across the organization simultaneously can opt for PowerShell.
Pre-requisites:
- Install Security & Compliance PowerShell Module
- Update SharePoint Online Management Shell
- Ensure you have global admin or compliance admin rights
Try { Connect-IPPSSession $NewPolicy = New-RetentionCompliancePolicy ` -Name "SharePoint Retention Policy" ` -Comment "Policy for SharePoint Data Retention" ` -SharePointLocation All ` -OneDriveLocation All ` -ModernGroupLocation All ` -Enabled $True New-RetentionComplianceRule ` -Name "Retention Policy Rule" ` -Policy $NewPolicy.Id ` -RetentionDuration 365 ` -RetentionComplianceAction KeepAndDelete ` -ExpirationDateOption ModificationAgeInDays } Catch { write-host "Error: $($_.Exception.Message)" -foregroundcolor Red }
What Are Retention Labels in SharePoint Online?
When I needed more precise control over specific documents, Retention Labels were the answer:
Feature | Retention Policy | Retention Label |
Scope | Entire site/mailbox | Individual files/folders |
Manual Application | No | Yes |
Auto-Apply Based on Conditions | Yes | Yes |
Record Declaration | No | Yes |
Use labels when you need document-level control or legal holds for specific types of records.
Impact of Retention Policies on SharePoint Sites
Now you have learned how to set retention policy in Sharepoint Online but implementing a retention policy introduces several key effects. Based on what I’ve learned, here are the side effects:
- Inability to Delete Sites – A SharePoint site that has a retention policy applied to it cannot be erased unless the policy is changed or removed. An error message will appear if the site is attempted to be deleted.
- Restrictions on Deleting Non-Empty Folders – Until the items inside a folder go beyond the retention policy timeframe, the folder cannot be removed.
- Preservation Hold Library – To ensure that no data is permanently destroyed before its retention period is finished, deleted items are moved to a Preservation Hold Library and stored there until their retention period has expired. After expiration, items are removed by the system.
How Retention Works Behind the Scenes?
If you’re exploring how to set retention policy in SharePoint Online, it’s just as important to understand how it functions once applied. A SharePoint retention policy deletes data or sites automatically after the retention period is over. Here is a simple way through which this procedure operates:
- Items stay in SharePoint until the retention timer expires.
- When auto-deleted, they appear in the Recycle Bin, showing “Deleted By: System Account.
- SharePoint runs background cleanup jobs every 30 days to check for expired content.
What Happens After Data Deletion?
Once data is removed as per the SharePoint Online retention policy, you cannot restore it. This is a permanent deletion governed by Microsoft 365’s compliance lifecycle.
That’s why I strongly recommend using automated tools to stay protected. I rely on SharePoint Migrator, a powerful utility that helps you:
- Backup SharePoint Online
- Migrate data to another tenant
- Avoid accidental loss during restructuring
It is the most reliable solution which helps to create copies of essential data into another tenant. This procedure is also known as SharePoint tenant to tenant migration. You can simply download this tool from the below download button and start using this tool to avoid the data loss situation.
Final Thoughts!
Understanding what is the retention policy for SharePoint Online is crucial for effective management of data and avoiding data loss. After this discussion, we have a clear answer to this query and related, i.e. how to set retention Policy in SharePoint Online. Additionally, it is necessary to review the SharePoint Online retention policy regularly using PowerShell or the Admin Center.
People Also Ask – Retention Policy in SharePoint Online
Q1: Can I use both retention labels and policies together?
A: Yes. If both are applied, the longer retention period takes priority.
Q2: How long does it take for a new policy to apply?
A: Up to 7 days across all services in Microsoft 365.
Q3: Can I remove a site under the retention policy?
A: No, not until the policy expires or is removed.
Q4: Do retention labels support versioning?
A: Yes, retention applies to all document versions.
Q5: What happens if a user tries to delete a file under retention?
A: The file is preserved in the Preservation Hold Library until the retention period ends.
Q6: Can I apply a retention policy to specific SharePoint sites?
A: Yes. When creating the policy, you can choose to apply it only to selected sites.