Requirement: Create a retention policy to preserve deleted items in SharePoint Online.
How to create a Retention Policy for SharePoint Online?
SharePoint Online retains deleted items for 93 days before they get deleted permanently. What if you want to preserve deleted items for more than 93 days? Say, for 10 years as per your compliance regulatory policies or legal requirements? Well, Office 365 retention policies give us the ability to retain and recover deleted items and files. You can preserve deleted files with the help of retention policies in the Office 365 compliance center. Basically, You have to create a retention policy and apply it to areas like SharePoint, OneDrive, etc. Here is how to create a retention policy in the Office 365 compliance center:
- Login to Microsoft Admin center at https://admin.microsoft.com as global administrator >> Open “Compliance Center” https://compliance.microsoft.com link from the left navigation.
- In the Compliance Center, click on “Policies” from the left navigation >> Choose “Retention” >> Click on “New retention policy”.
- Provide a name to your policy and optionally the description. E.g. “Retain Deleted items for 10 years”.
- We can use these policies to either preserve or remove items, We’ve also options like the retention policy based on the creation date or the last modified date. Here in my case, I’ve selected to retain deleted content for 10 years and not to delete the content automatically.
- Choose locations to preserve such as SharePoint Online and OneDrive for Business. You can apply the policy globally or to specific site collections.
- Review your settings and then click on the “Create this Policy” button to create the policy.
- Wait till the status of the Policy changes from “On (Pending)” to “On (Success) “. Although the compliance center tells us, it may take up to 24 hours to apply the policy, it actually depends on the volume of your content. It took me 10 minutes to activate the policy in my case.
SharePoint Online Retention Policy in Action:
Once the retention policy is applied to your SharePoint Online site(s), You’ll see the below changes:
- You’ll see a new library, “Preservation Hold Library” on the site contents page as soon as you delete any item or edit an existing item for the first time. (This library is visible only to Site collection administrators!). You can recover deleted items from it.
- If you try to delete a list or library that has content, you’ll see an error message “List cannot be deleted while on hold or retention policy.”
- You can’t delete a folder with its contents! If you try, you’ll face the “You have to delete all the items in this folder before you can delete the folder.” error! You can either use Explorer view or PowerShell to delete all files in a folder recursively.
- You can’t delete a site collection from the Admin center (or even with PowerShell!). You must exclude the site from the retention policy to delete the site.
When a list item or a document is deleted in SharePoint, to goes to the recycle bin and a copy of the item is send to the preservation hold library! Also, a copy of the original content is retained in the Preservation Hold library when users edit existing documents (that are created prior to applying the policy!).
Storage Consumption by the SharePoint Retention Policies:
When a retention policy is active, SharePoint keeps copies of deleted or changed documents in the “Preservation Hold Library” and starts consuming the storage quota. So, when users edit and delete a lot of files, the versions build-up, and you can expect higher storage consumption.