Skip to main content
< All Articles

How to delete content from SharePoint Sites using Retention Policies and Retention Labels

Most of my articles about retention were related to the ability to retain content or prevent its modification and deletion for some time. However, there might also be a need to delete old/outdated content from a SharePoint site. For example, you migrated from file shares to SharePoint Online and would like to delete documents created or modified more than ten years ago. Or, you might have a legal or regulatory requirement to delete all documents created over a year ago. Luckily, in those cases, you can set up your retention policies to find/identify and delete such content based on the retention settings. Let me explain how this works.

Two ways to delete old content from a site using the retention policies

Just like with retention and records management, there are two ways for you to get rid of the outdated content on your SharePoint sites:

Let me describe both options below.

How to delete content from SharePoint Site using Retention Policies

When you want to apply a blanket policy to delete content on the entire site, you can rely on the Site Retention Policy to delete content. Here are the steps.

    1. From the Microsoft 365 App Launcher, click on ComplianceMicrosoft 365 app launcher with the Compliance app highlighted
    2. Under Solutions, click on Data lifecycle management > Microsoft 365.Purview Solutions menu with Data lifecycle management and Microsoft 365 highlighted
    3. Once in the Data lifecycle management dashboard, click on Retention policies > New retention policydelete content from SharePoint Site using Retention Policies and Retention Labels
    4. Give your policy a name, click NextName your retention policy page with a policy name and description field
    5. On the next screen, you can choose Admin Units. For this post, click Next, but if you want to learn more about this functionality, click here.Policy Scope page with Admin Units set to Full directory and the Next button
    6. On the next screen, you have to choose the policy type you want to create: Adaptive or Static. I explained the difference in this article. For this exercise, I am going to choose Static. Click Next.Retention policy type choice with Static selected and the Next button
    7. Choose the site(s) to which you would like to apply the policies, and click Done.Microsoft 365 Group mailboxes and sites picker with the Project TIAI site selected
    8. Click Next to proceed to the next screen.Create view dialog naming the view Employee Directory - Gallery, Gallery selected
    9. On the next screen, you have to specify the retention settings. We are deleting items, not retaining them, so choose Only delete items when they reach a certain age. In my case, I am deleting documents once they have not been modified for 2 days. Realistically, you might want to set a much higher limit.Retention settings to only delete items older than 2 days since last modified
    10. On the next screen, review the setup and click Submit to create and publish the policy. Note the warning message about items to be deleted.delete content from SharePoint Site using Retention Policies and Retention Labels
    11. You will then receive a confirmation message.Confirmation that the retention policy was created, enforced within a week

What happens when the Site Deletion Policy takes effect?

  1. The policy took effect within less than 24 hours, and I ended up with a much cleaner document library. The below screenshot shows the library before the Site Deletion Policy was applied.SharePoint Documents library before the deletion policy, listing folders and many test documents
  2. And here is the same library after the Site Deletion Policy was applied.SharePoint Documents library after the deletion policy, with only folders and one test spreadsheet left
  3. All the deleted documents went straight to the Recycle Bin.SharePoint site Recycle bin showing documents deleted by the System Account

How to delete content from SharePoint Site using Label Retention Policies

Just like you can delete old content using the Site-level policies, you can do so using the label retention policies – by applying the label to individual items.

    1. From the Data lifecycle management, click on the Labels tab, then Create a labelData lifecycle management Labels tab with the Create a label button highlighted
    2. Give your retention label a name/description, and click Next.delete content from SharePoint Site using Retention Policies and Retention Labels
    3. Choose the middle option: Enforce actions after a specific period, click Next.delete content from SharePoint Site using Retention Policies and Retention Labels
    4. On the next screen, define the period and when it should begin. In my case, I am just setting up 2 days so we can easily test. Click Next.Define the period page for a 2 day label starting when items were last modified
    5. Next, choose what will happen after the period expires. In our case, we want to choose: Delete items automatically.delete content from SharePoint Site using Retention Policies and Retention Labels
    6. Next, review the settings and click Create label.Review and finish page for a delete-only retention label with the Create label button
    7. On the next screen, you will get a confirmation and recommendation to publish the labelRetention label created page with Publish this label to Microsoft 365 locations selected
    8. Click Done to proceed and publish the label to SharePoint Site(s).Retention label created page with the publish option selected and the Done button
    9. Click Next.delete content from SharePoint Site using Retention Policies and Retention Labels
    10. Click Next to skip Admin Units, which I explained above.Policy Scope page showing Admin Units set to Full directory with the Next button
    11. For this article, choose Static. Click Next.Retention policy type choice with Static selected and the Next button
    12. Just like with the Site Retention Policy above, choose a specific site(s) to publish the label to. Click Next.Choose where to publish labels with Microsoft 365 Group mailboxes and sites turned on
    13. Give your policy a name, and click Next.Name your policy page with the label policy name field filled in
    14. On the final screen, review the settings and click Submit to publish the label.Finish page for the label policy with the Submit button highlighted
    15. You will then receive a confirmation message.Confirmation that the deletion retention label was published

What happens when the Label Retention (Deletion) Policy takes effect?

  1. After the label is published, you will be able to tag items with the label.Library details pane with Apply label showing the deletion label on a document
  2. In my case, I am tagging 4 documents within a librarydelete content from SharePoint Site using Retention Policies and Retention Labels
  3. After a few days, those labeled documents are removed from the library (due to deletion policy)SharePoint library after deletion with retention label columns empty and remaining items listed
  4. And the labeled documents end up in the Recycle Bin, per the policy.Recycle bin listing labeled documents deleted by the System Account
Gregory Zelfond, the SharePoint Maven - profile photo

About Me

I’m Greg Zelfond, a U.S. based SharePoint consultant, and I provide affordable out-of-the-box SharePoint consulting, training, and configuration assistance to small and medium-sized businesses all over the world.

Need help?