Skip to main content

How to set a Retention Policy on a SharePoint site

Some time ago, I published an overview of the modern Compliance features available in SharePoint Online and Office 365. With this post, I would like to dig deeper and explain to you, my loyal blog followers, on how to set a simple retention policy on a SharePoint site.

Real-life Retention Policy Example

Due to industry regulations, we need to retain documents for at least 7 years, after which they can be deleted.

In my example though, I will retain documents for 2 days after they were last modified, then delete them as I do not want to wait for 7 years to finish this article for you 🙂.

Access Security & Compliance Admin Center

  1. Navigate to the Office 365 Admin Centers
  2. From the list of available Admin Centers, click on Security & Compliance

How to create and publish a Retention Policy on a SharePoint site

Now that we are in the Security & Compliance Admin Center, we are ready to create and publish a Retention Policy on a SharePoint site.

  1. Under Data Governance, click Retention
  2. Hit Create button to create new Retention Policy
  3. Give your policy a name and description. Hit Next
  4. On the next screen is where you set up the logic. You can configure how many days, months, or years to retain the content for, specify whether you want the math (retention period) to be calculated from the Created Date or Last Modified Date. Lastly, you can also specify whether you want to keep or delete content after the Retention period expires. Hit NextRetention Policy on a SharePoint site
  5. On the next screen, you get to choose where to apply the policy. You can apply it to email (Exchange), SharePoint sites, OneDrive accounts as well as Office 365 Groups.
  6. In my case, I applied a policy to a single Office 365 Group Site
  7. On a final screen, you need to review and confirm the settings and click Create this policy button. It is imperative to note the message you get to see at the bottom. It warns you that content might be deleted as soon as the policy takes effect according to the logic you set up in previous steps.
  8. It says it can take up to 24 hours for a policy to take effect, but in my case, it just literally took minutes. If you go back and click on the retention policy you set up – you will see its status and whether or not it has been deployed.

What happens after you publish a Retention Policy on a SharePoint site

  1. Your site can no longer be deleted as it now has a compliance policy set on it. If you try to delete it – you will receive an error message: A Compliance policy is currently blocking this site deletionRetention Policy on a SharePoint site
  2. Your site will now get a Preservation Hold Library (more on it below). It is a special library that retains content during the retention period in case document has been modified or deleted. To be precise, the Preservation Hold Library is not created until any one file is modified or deleted.
  3. You will not be able to delete a folder on a site anymore without first deleting its contents. You might find it annoying, but that is how it works when a Retention Policy is set on a SharePoint site. You will now get the following message when you try to delete a folder (that is not empty): You have to delete all the items in this folder before you can delete the folder.Retention Policy on a SharePoint site

How does Retention Policy on a SharePoint site work?

Every day a timer job scans content on a site and determines its outcome based on a retention policy being set. There are several possible scenarios:

If the user has not deleted the document

If the document in the library has not been modified or deleted by the user, it will be moved to the recycle bin automatically upon the end of the retention period. In such cases, it will state that the files were deleted by System Account and not the human being (screenshot taken from the site Recycle Bin).

If the user has deleted the document

If the users have deleted the document, the file will end up in the Recycle Bin. However, it will also be copied to the Preservation Hold Library I mentioned earlier. This Preservation Hold Library assures that the documents are retained for the duration of the retention period and cannot be deleted. You will notice automatic suffixes added to the deleted documents. The latter part of the suffix contains the date and time stamp designating when the document was moved to the Preservation Hold Library.

Retention Policy on a SharePoint site

Note that if you try to delete a document from the Preservation Hold Library, you will get the error message.

Microsoft had published an excellent post explaining the logic of Preservation Hold Library – they also have a helpful diagram illustrating the workflow. You can access it here.

You may also like

An overview of compliance features in SharePoint and Office 365

September 25th, 2019

You may also like

How to set up retention and deletion policies for files and folders in SharePoint

June 1st, 2017

You may also like

How to set site closure and deletion policies in SharePoint Online

March 27th, 2017

Need SharePoint Help?

Hourly consulting, training and configuration services are available

Learn More