Site icon Joanne C Klein

Purview Retention Controls on OneDrive Auto-generated Folders

Purview Retention controls on OneDrive auto-generated folders
Reading Time: 5 minutes

A customer recently asked me if the files uploaded to a Teams chat could be removed after a period of time. Although the capability to apply a retention policy to Teams chats to remove them after a period has been around for a very long time, it does not target the files that were uploaded during the chat. This is what the customer wanted to address.

The specific ask: “We want to delete all Teams chat files after 1 month to align with our deletion of Teams chats.”

Whether you agree with the ask or not isn’t the point of this post. The point is determining if it can be done and if so, how.

Short answer: yes

How? keep reading. 😊

The first thing to understand is that Teams chat files are stored in an auto-generated OneDrive folder named Microsoft Teams Chat Files. The second thing to understand is that this requirement cannot be accomplished with a retention policy… it requires a retention label since it is targeting a specific folder’s content.

To broaden my answer for this post, this post shows how to apply a retention label to content within any auto-generated OneDrive folder – something you may find yourself/your customer wanting to do.

Table of Contents


📂 Auto-generated OneDrive Folders

Whether you’ve noticed them or not, OneDrive automatically creates folders at the root of every users’ OneDrive document library to organize files from numerous Microsoft services. I’m assuming this is done so they can be resurfaced and shared across other Microsoft services in a reliable and consistent way. These folders are created on-the-fly and, as far as I can tell, aren’t created until a OneDrive user uses the service requiring it.

Knowing what these folders are named and what’s contained within them helps to inform the controls you may want to place on them.

Here’s a summarized visual that shows the folder names and a high level description of the content stored in each (as of September 2025):

‼️Important. 2 of the above auto-generated folders have built-in expiration/deletion and so you do not need to configure a retention label to do it for you unless you wanted to override the default behavior:


🏷️ Steps to Apply Retention Labels

What if you want to apply a retention label to content within a specific folder above? Let’s use the initial customer ask as an example:

The customer ask: “Delete all Teams Chat files after 1 month.”

Step 1: Create a Purview retention label

Step 2: Create an auto-apply retention label policy

Step 3: Validation

Once you’ve turned on the auto-apply label policy, you may want to validate the retention label has been applied to the content in the above folder. There are 2 methods to do this:

  1. Scalable: Use Purview eDiscovery/Content search to look for your retention label in the OneDrive accounts scoped in your label policy.
  2. Thru the UI on your own OneDrive which is what I’m showing below.
    1. From the OneDrive… Settings… OneDrive settings… Return to classic OneDrive
    2. Create a classic view to include the retention label and when it was applied (Settings… Site contents… select the document library, create a new view)
    3. Navigate to the Microsoft Teams Chat Files folder
    4. You will see the retention label and the date it was applied. (in my test, the retention label is named Legal Matter TEST)

5. The label will be applied not only to items within the Microsoft Teams Chat Files folder, but also to any items in subfolders within that folder (not that any subfolder will likely be created in there, but I created a folder called Some random subfolder for testing purposes to show the label will be applied to content within it as well):


✍️ KeyQL reference for content in each auto-generated folder

The below KeyQL queries can simply target the ParentLink folder as shown in the above example or they can be more specific by also targeting other properties such as FileExtension or ProgID. In all cases, the retention label is applied to any matching items within the folder. Build the query to fit your requirements:


⚠️ 2 downsides to the ParentLink approach


✅ Key Takeaways

Thanks for reading!

-JCK

Exit mobile version