Thumbnail Applying inactive retention labels

Applying inactive retention labels

The below is a screenshot of the Purview portal with a simple retention label setup on my tenant. I’ve created two record-type retention labels that keep files around for 10 years and delete them afterwards. This picture contains two very interesting words that form the basis of todays post: active and inactive. So what does that mean?


For those of you that have created retention labels before, you’ll probably know what this means. The difference between these two retention labels is that the one has been included in a Label Policy, while the other has not.

I find it an interesting choice of words, because a label can be inactive and still be in use. In my case the “inactive” retention label is much more “in use” than the “active” retention label. I’ll explain what I mean by that in a second, but let’s first go through the options:

A retention label is marked as active when it is included in a label policy. That can be one of two types of label policies. The first is a regular label policy, which is a policy meant to publish or distribute your retention labels across your tenant so that users can manually apply them to their content. Creating such a label policy is quite straightforward in Purview:


The other type is the auto-apply label policy. This isn’t meant for distribution, but as the name indicates for automatic application of retention labels. Such a label policy will automatically apply the retention label to content that matches the conditions you’ve set. Creating an auto-apply label policy is a bit more complex, but it’s a very powerful tool once mastered.


Both types of label policies cause the retention label to be marked as active. Even if both have a different effect.

Note: There's also a third type of policy called a 'Retention policy'. However, that does not publish a retention label, but uses another type of retention, which is a subject for another post.

As I wrote before, I’m curious about the choice of words. Because a retention label can be inactive and still be in use. In my case I’ve recently done a cleanup round on my dev tenant by excluding almost all my retention labels from their respective label policies. I’ve deleted most of my label policies. Which means most of my retention labels are now marked as inactive. But even if they’re marked as inactive they have been used and applied to content across my tenant. A lot of content is currently being retained on my tenant by “inactive” retention labels. So we might say they’re still very much active! They’re doing their jobs: keeping people (me and my demo-users) from deleting content for the required amount of time!

But there’s another, far more interesting reason why some of my retention labels are marked as inactive. And that is because I’m applying them in custom automation! I’m applying retention labels to my content automatically, using an Azure Function. Why I am using custom automation? That’s a subject for another blog post. But there’s enough reasons why you could need it. And in those scenario’s, it’s actually quite logical to not include your retention labels in a label policy, as you typically want to keep users from applying retention labels that should be applied automatically.

So even if users cannot select certain retention labels in SharePoint:


…I still can apply them to content using custom automation:

# Applying a retention label to a file using the CLI for Microsoft 365
# Version used for this post: 7.4.0
m365 spo file retentionlabel ensure --name 'Retain 10 years after creation' --fileUrl '/Shared Documents/Document.docx' --webUrl ''

…and the retention label will be nicely applied to the file:


“Active” and “Inactive” are an odd choice of words. But there’s a good reason you may want to keep your retention labels as inactive: you may not want your users from selecting a label that ought to be applied automatically by custom automation. You may want users to not see any retention label at all in the retention label dropdown! The only way to do that is to have “inactive” retention labels, by not including them in any label policy.

By the way: if you are interested, the CLI for Microsoft 365 is a great scripting tool that has an entire suite of commands for managing and applying retention labels. Check out the links in the sources below for more information.

Happy coding!

And these are just two of the many commands available for retention labels. Check out the documentation for more information.

purview retention sharepoint
Support me by sharing this


More blogs

4 benefits of starting your DLM journey today
4 benefits of starting your DLM journey today

This post highlights 4 key benefits of implementing data lifecycle management.

Read more
Daisy-chaining retention labels and automated archival
Daisy-chaining retention labels and automated archival

An partner-post with Joanne C. Klein on how to automatically move files labelled with a Purview retention label to some archive location.

Read more
Automating Purview data retention using Azure Functions
Automating Purview data retention using Azure Functions

An example of how to automatically apply Purview retention labels using Azure Functions.

Read more


Thanks for reading

Thanks for reading my blog, I hope you got what you came for. Blogs of others have been super important during my work. This site is me returning the favor. If you read anything you do not understand because I failed to clarify it enough, please drop me a post using my socials or the contact form.

Warm regards,

Microsoft MVP | Microsoft 365 Architect

Microsoft MVP horizontal