In this post we will discuss about Document Deletion Policies in Office 365 SharePoint Online. What are Document Deletion Policies in Office 365 and how we can create document deletion policy as well as how we can implement the document deletion policy in a site collection.
In lots of enterprise one common requirement comes as to store documents for a specific period of time and after that the document should get deleted. SharePoint Online provides this document deletion policy feature which will help to achive this kind of requirement. It will delete documents from the site after a specific period of time. Not only from sharepoint site, it also delete documents from user's OneDrive for Business sites.
Previously SharePoint provides Records management and Information management policies which are helpful to deal with structured data. Document deletion policies helps in automatic deletion of unstructured data such as OneDrive for Business sites and team sites.
Also you can read:
Below are few points we should remember in document deletion policies:
- As the name suggest document deletion policies works only for document libraries not with list.
- Three main components in this: Policies, Rules and Site Collections
We can create single or multiple policies. We can add single or multiple rules to a single document deletion policy. And then we can assign a policy to a site collection template (like team site template) or to a single site collection also. When you assign a document deletion policy to a site collection template, then the policy will be available to all site collections created from that template.
- Apart from this you can also create a single policy and make it mandatory. Then the policy can be assigned to all sites in site collection.
- Document deletion policies are inherited meaning if a site owner select a document deletion policy for their site then all the subsites will inherit the policy from the parent. But site owner can anytime breat the inheritance and can apply a different policy.
- Whenever you apply a document deletion policy , you should remember that the time period depends on the document was created or modified, not the time since the policy was assigned. When you assign the policy for the first time, all documents in the site are evaluated and, if they meet the criteria, they will be deleted. This applies to all existing documents, not just new documents created since the policy was assigned.
- Another point to remember is that, A site collection or a site collection template can have one or more policies assigned to it, and each of those policies can have one or more rules. But there can be only one policy can active per site and there can be only one deletion rule that’s active at any time for the libraries within the site. Check a very good fig like below:
Create Document Deletion Policies:
There two ways you can create open Document Deletion Policy Center:
From Office 365 Security & Compliance:
Login to your Office 365, then from App launcher click on "Security & Compliance Center". Then from the left navigation, click on "Data management" and then click on Retention. Then from the Retention, click on "Manage document deletion policies for SharePoint Online and OneDrive for Business". First time when you click on this link it will create the Document Deletion Policy Center automatically.
From Create New Site Template:
The other way we can create Document Deletion Policy Center is Login to Office 365, then go to sharepoint administration. There create a new site collection and then choose "Compliance Policy Center" template which is under Enterprise tab as shown in the fig below:
Then in the Compliance Policy Center, click on Deletion Policies like below:
This will open the Deletion Policies library which will have two default Policies. Click on New item to create a new policy.
Here in the New Deletion Policy page, give a Policy Name, and Description.
Then click on +New button to add a new rule to the policy. Here give a name for the rule. Either you can delete item to recycle bin or you can permanently delete item. Here I have choosen Delete to Recycle Bin option.
Date from when the document deletion date will be calculated, in this case choose either Last Modified Date or Created date. Whatever option you will choose, the time period calculation will be done based on this option.
Time period after which the document will be deleted: Here you can add Years, Months or Days. Lets us say if you want to delete documents whose last modified date before 2 month, then you can add 2 in the textbox and then select Months from the drop down.
Also you can Set as default rule check box to make this rule as default rule.
Once you Save the rule, the policy will look like below:
Then click on Save to Save the Policy. It will reflect in the Deletion Policies library. You can see now 3 policies.
Assign Deletion Policies to Site Collection Templates:
Now we will assign the policy to a site collection template. So that the Deletion Policy will be available to all site collections created from the same template.
In the Document Deletion Policy Center, click on "Policy Assignment for Templates" link and then click on +new item in "Policy Assignments for Templates" library like below:
Then in the New Template Assignment, first click on "First choose a template" button as shown in the fig below:
Here either you can choose from OneDrive for Business Template or You can choose from Site Collection template. Then I am choosing here for Team Site template. So any site collection using Team site template will have this Policy.
Then assign the rule which we have create in the previous steps like below:
Now you will look at the New Template Assignment, the screen looks like below. Where we have choosen the Template, Rule. And also if you want to make this rule as mandatory, then check the checkbox "Make Policy as Mandatory" like below:
Assign Policy To Site Collection:
Now we will discuss how we can assign Document Deletion Policy to site collections. From the "Document Deletion Policy Center" site, click on "Policy Assignments for Site Collections" link as which will open "Policy Assignments for Site Collections" document library. Here click on +new items as shown in the fig below:
Then in the "New: Site Collection Assignment" page click on "First choose a site collection" link. This will open Choose a site collection dialog box. Here search for your site collection as shown in the fig below:
Then click on OK. Then assign the rule as shown in the fig below, and also if you want to make the policy as mandatory, then check the checkbox "Mark Policy as Mandatory" as shown in the fig below:
Check Policy in Site Collection:
Now we can the Policy in the site collection. Go back to your Office 365 SharePoint online site collection. Click on the gear icon and then click on Site settings. This will open Site settings page. Click on "Document Deletion Policies" which is under Site Collection Administration.
If you will not be able to see this link, wait till 24 hours, it should be visible. For me it came after 2 hours. It should be look like below:
The policy will appear like below:
Hope this will be helpful.