Office 365 Retention Policies

KB ID 0001620


Most things in Office 365 operate on a 30 day retention principle, but what if you are governed by restrictions that require you to retain your data for 5 years or 7 years in some cases? We have had Retention policies in Exchange for years, and I knew you could create a policy in exchange online, but what about OneDrive or SharePoint data?

Well with O365 you can specify a ‘top level’ retention policy that applies to ‘most’ of your data. I say most because some application data is not 100% retained.

BE AWARE: Despite the name containing ‘retention’ this is also how you specify when to automatically delete old files (if that is MORE your requirement).


From Office 365 admin > Admin Centers > Security and Compliance.

O365 Security and Compliance

Information governance > Retention > Create.

O365 Retention Policies

Give your policy a name > Next.

OneDrive and Exchange Retention Policies

Obviously we want to choose ‘Yes I want to retain’ > I would change the retain based on to ‘when it was last modified’ > Next.

Note: You can choose the second option to automatically delete files that are a certain age.

Note2: You can add a specific policy for files containing certain words/phrases or specific date i.e. financial, (at present this does not apply to Teams).

Office 365 Retention Policy Settings

Specify ‘What’ you want to apply the policy to, by default it’s off for Skype and Teams Data, and Exchange public folders strangely? > Next.

Office 365 Retention Policy Locations

Review the settings > Create this policy.

Office 365 Retention Policy Changes


Office 365 Retention Policies via PowerShell

As usual, you can do similar things with PowerShell;

New-RetentionCompliancePolicy -Name "PeteNetLive-Retention-Policy" -ExchangeLocation All -SharePointLocation All -ModernGroupLocation All -OneDriveLocation All -Enabled $true
New-RetentionComplianceRule -Name "PeteNetLive-Retention-Policy-Rule" -Policy "PeteNetLive-Retention-Policy" -RetentionDuration 2555

Note: 2555 Days is 7 years.

Related Articles, References, Credits, or External Links


Author: PeteLong

Share This Post On


  1. Hi Pete, thanks for the great article. Do you by any chance know if a retention policy that is set for SharePoint in the compliance center would also affect One Drive also as this is the basis for it?


    Post a Reply
    • I don’t know, but I’ll open it up for comment…

      Post a Reply

Submit a Comment

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