How to use enterprise keywords to apply retention labels in Microsoft 365
by Rob Aaldijk, on Mar 27, 2024 2:04:05 PM
Microsoft Purview Records Management technical deep-dive
You may have seen earlier articles like this one, showing how to locate documents in Microsoft SharePoint Online that have one or more enterprise keywords attached. The challenge here is to avoid search results including items that have that keyword as part of their full text.
From this, some companies have wondered if enterprise keywords may be used to classify their content into categories that may be mapped against their information retention schema. In practice, this proves to be a bit more challenging than you would initially expect. We found out the hard way but are happy to share a practical solution in this article.
The prerequisite to use enterprise keywords in SharePoint Online as a reference for retention schemas is threefold:
- You obviously must map your keyword categories against your retention schema. You could do this one-on-one, meaning one keyword represents one retention term in the schema. Alternatively, multiple keywords could fit a single retention term. The latter approach would reflect e.g. individual document types that fall under a certain retention category in your schema.
- You must apply the agreed keyword set consistent against the content stored in SharePoint Online. You might leave this to end users, but as they can make mistakes, best try and automate this using e.g. Microsoft SharePoint Premium, Power Automate or other means of automated classification.
- You must have Purview Records Management set up to apply the correct retention label corresponding to the keyword category used to tag the relevant items in their libraries and sites. Here is where it gets tricky, and the next paragraph will explain how we solved it.
How to set up Microsoft Purview Records Management to use enterprise keywords
So the technique of setting up MS Search to enable searching for keyword-tagged items only works as such, but we found that it does not apply to Purview Records Management. To summarize, the idea is to map a managed search property to the available keyword crawled properties, and then use it in item searches instead of using just the keyword itself, which also renders full-text results.
However, the auto-apply policy function in Purview Records Management did not accept a keyword matching query based on the managed property we defined. After some additional research and experimenting, we found the solution:
- Instead of defining a new managed property, use one of the available refinable strings (RefinableStringxx). Map that to the available crawled keyword properties (we mapped to all the ones mentioned in the article referred earlier, so TaxKeyword, ows_Keywords etc.).
- Use the thus mapped refinable string in the keyword query of the auto-apply retention policy. E.g. if you defined RefinableString10 as your mapped property, a corresponding KQL query in the auto-apply policy might look like: ‘RefinableString10:fin1000’ to reflect a category of financial records in the retention schema.
This will work. You may test the query first in MS Search – only items that have the specified keyword tagged should be returned in the search result. You may also turn on simulation mode with the newly defined policy (but we found it does not always behave consistently, recommend to use the MS Search method instead).
Hope this research helps you consider the use of keywords to map your content to your retention schema, as one of the many options to achieve that.
In case of questions or concerns, feel free to reach out.