How to Troubleshoot Retention Policy Keeps Deleted Files Visible
🔍 WiseChecker

How to Troubleshoot Retention Policy Keeps Deleted Files Visible

When you delete a file in SharePoint or OneDrive, it may remain visible in the document library even though the retention policy is active. This happens because retention settings preserve the file metadata and a placeholder entry in the library until the retention period ends. In this article, you will learn why deleted files stay visible and how to verify and adjust retention policy settings to control this behavior.

Key Takeaways: How Retention Policy Keeps Deleted Files Visible

  • Retention policy label assignment: Files with a retention label remain visible in the library until the retention period expires, even after deletion.
  • SharePoint admin center > Retention policies > Preservation Hold library: This hidden library stores the actual file copy, while the original location shows a placeholder.
  • PowerShell cmdlet Get-RetentionCompliancePolicy: Use this to check the policy scope and retention duration for specific locations.

ADVERTISEMENT

Why Deleted Files Remain Visible Under a Retention Policy

When a file is deleted from a SharePoint document library that is covered by a retention policy, the system does not immediately remove the file entry. Instead, SharePoint moves the actual file content to a hidden preservation hold library. The original location retains a placeholder entry that shows the file name, metadata, and a deletion timestamp. This placeholder remains visible to users who have permissions to see deleted items in the library.

The retention policy ensures that the file is kept for the specified period, even after a user deletes it. The policy does not remove the file from the user interface until the retention duration has passed. This behavior is by design and applies to both SharePoint and OneDrive for Business.

Preservation Hold Library

The preservation hold library is a system-managed container that stores all versions and deleted copies of files that are under retention. It is not visible in the default site navigation. Site collection administrators can access it by appending /PreservationHoldLibrary to the site URL. The placeholder in the original library points to this hidden library.

Retention Policy Types

Two types of retention policies affect file visibility after deletion:

  • Adaptive policy scope: Applies to specific users, groups, or sites based on defined criteria. Files deleted by users in scope remain visible.
  • Static policy scope: Applies to all content in included locations, such as entire SharePoint sites or OneDrive accounts. All deleted files in those locations remain visible until retention expires.

Steps to Verify Retention Policy Settings and Reduce File Visibility

Before making changes, confirm which retention policy is causing the behavior. Then adjust the policy settings or the user permissions to hide deleted files.

Check Which Retention Policy Applies to the Site

  1. Open the Microsoft Purview compliance portal
    Go to https://compliance.microsoft.com and sign in with a compliance admin or global admin account.
  2. Navigate to Retention policies
    In the left navigation, select Data lifecycle management then Microsoft 365 then Retention policies.
  3. Identify the policy affecting the site
    Review the list of policies. Look for a policy that includes the SharePoint site URL or the OneDrive account in its scope. Click the policy name to view its details.
  4. Check the retention period
    In the policy details pane, note the retention duration. This is the time the deleted file will remain visible. You can reduce this period if your organization allows it.

Reduce the Retention Period to Hide Deleted Files Sooner

  1. Edit the retention policy
    From the policy details pane, click Edit policy.
  2. Change the retention duration
    Under Decide if you want to retain content, delete it, or both, adjust the number of days or years. A shorter period means deleted files become hidden sooner.
  3. Save the policy
    Click Submit to apply the change. The new retention period will apply to all new and existing content.

Remove the Retention Policy from the Site

  1. Open the policy edit wizard
    In the compliance portal, select the policy and click Edit policy.
  2. Change the scope
    In the Locations step, uncheck SharePoint sites or OneDrive accounts to remove the site from the policy. Alternatively, choose a static scope and remove the specific site URL.
  3. Confirm the change
    Click Submit. After the policy no longer applies, new deletions will not create placeholders. Existing placeholders will remain until the original retention period ends, unless you manually delete them.

Hide Deleted Files from Users by Adjusting Permissions

  1. Go to the SharePoint site
    Navigate to the site where deleted files are visible.
  2. Open site permissions
    Click Settings (gear icon) then Site permissions.
  3. Change the permission level for the affected users
    Select the user or group that currently sees deleted files. Change their permission level to Read or Contribute without the View Application Pages permission. This prevents users from seeing the preservation hold library entries.
  4. Test the change
    Ask a user to delete a file and then refresh the library. The file should no longer appear in the list.

ADVERTISEMENT

If Deleted Files Still Appear After Adjusting the Policy

Deleted Files Still Visible in SharePoint Library

If you reduced the retention period or removed the policy but deleted files remain visible, the preservation hold library still holds the placeholder. Run the following PowerShell command to check the retention status of the file:

  1. Connect to SharePoint Online PowerShell
    Open Windows PowerShell as an administrator and run Connect-SPOService -Url https://[tenant]-admin.sharepoint.com.
  2. Get the site collection
    Run Get-SPOSite -Identity [site URL] to confirm the site is accessible.
  3. Check the preservation hold library
    Use Get-PnPFolder -FolderUrl "PreservationHoldLibrary" after connecting to the site with Connect-PnPOnline. This shows the files still under retention.
  4. Manually delete the placeholder
    If the retention policy no longer applies, a site collection administrator can delete the file from the preservation hold library directly. Navigate to [site URL]/PreservationHoldLibrary and delete the item.

OneDrive Shows Deleted Files Under Retention

OneDrive for Business behaves the same as SharePoint. Deleted files remain visible in the OneDrive recycle bin and in the library if the user has the Site Collection Administrator permission. To hide them, apply the same policy changes in the compliance portal. The user can also empty the second-stage recycle bin, but files under retention will reappear until the retention period ends.

Retention Policy Excludes the Site but Files Still Visible

If you removed the site from the policy scope, existing placeholders remain until the original retention period expires. You must wait for the retention period to end, or manually delete the files from the preservation hold library as described above. To avoid this in the future, set a short retention period when creating new policies.

Retention Policy Settings and Their Impact on File Visibility

Setting Effect on Deleted Files User Visibility
Retention period of 1 year File placeholder visible for 1 year Visible to users with site permissions
Retention period of 0 days File deleted immediately, no placeholder Not visible
Policy scope removed from site New files not retained; old placeholders remain Old files visible until retention expires
User permission set to Read only Placeholder still exists but user cannot see it Not visible to that user

You now understand why retention policies keep deleted files visible and how to adjust the settings to control that visibility. Start by checking the policy scope and retention duration in the compliance portal. If you need immediate cleanup, use the preservation hold library to manually remove placeholders. For future policies, set a shorter retention period to reduce the time deleted files stay visible.

ADVERTISEMENT