Microsoft.Exchange. PswsClient.PswsException when trying to AutoApply a retention label with KQL

December 10, 2019 · 1 min read

​If you try to AutoApply a retention label using the Office 365 Security & Compliance Center you might get an error message if you use KQL (Keyword Query Language):

autoapplylabelerror.PNG

This is because a KQL query for AutoApply only allows you to use certain “Queryable” Managed Properties. Some of them are listed here: https://docs.microsoft.com/en-us/microsoft-365/compliance/keyword-queries-and-search-conditions#searchable-site-properties

But the Managed Properties in the article listed above are not the only ones. Although you cannot use custom Manged Properties (that are queryable), you can use the predefined ones like RefinableString00 etc. Make sure that you don’t use the alias name in the query. This is valid KQL but doesn’t work in the AutoApply policy.

You can associate crawled properties to managed properties in the SharePoint Admin Center | More Features | Search | Manage Search Schema.

Markus