Adaptive scope syntax

Copper Contributor

I've been asked to create some retention policies for mailboxes using Purview.

 

Existing users should have an M365 retention policy that retains for 5 years.

 

Separated users, whose mailboxes have become Inactive Mailboxes, should have a 2 year retention and then delete.

 

To do that, I thought I'd create two separate policies targeting different adaptive scopes.  The first is pretty easy, any active mailbox.

The second - well I am not having much success getting a query to find Inactive Mailboxes that are 2 years old or newer.  Is it possible to use the utcNow() function within an adaptive scope query?  Something like:
(IsInactiveMailbox -eq "True") -and (WhenSoftDeleted -lt 'addDays(utcNow(),-730)')

it errors out on that last ' ... 82nd character.

4 Replies

Hi @MC_Edwards,

 

There is an error in the setup. Here are the steps:

  1. Create an adaptive scope. Choose user. Use the query: IsInactiveMailbox -eq "True"
  2. Create a retention policy. Configure the settings to retain for 2 years then delete. On the "scope" step of the wizard, choose adaptive scope, then select the scope you created in step #1.
  3. The policy will only apply to mailboxes included in the adaptive scope, so therefore only inactive mailboxes.

For the active user policy, I would follow the same steps, except use this query for the adaptive scope, just to ensure there is absolutely no overlap: IsInactiveMailbox -eq "False"

 

Here's a blog post about working with adaptive scopes + mailboxes: Using Adaptive Policy Scopes to Apply M365 Retention to Shared, Resource, and Inactive Mailboxes - M...

Hello Erica,
I have like to create an adaptive scope for all M365 service date and apply a retention of 5years to it. Example Exchange, SharePoint, OneDrive and MS Teams. Please can you guide me on this.

Hi @Igbins81, will you be scoping to all exchange mailboxes, all SharePoint sites, all users' OneDrive, and all Team messages? If so, you can use static scope instead and create a retention policy. If you are trying to target specific groups of users or sites, you can definitely use adaptive scope.

 

You can follow the steps here: Automatically retain or delete content by using retention policies | Microsoft Learn

 

Please let me know if you have any follow up questions!

 

 

@sophieke, We already have a manual process using static for exchange mailbox date, one retention policy keeps items forever for if someone leaves the company and the other 6 years retention period and delete items automatically. I want to stop manually going to add these users. So I want to automate to retain these two scenarios using adaptive scope as oppose to a manual process. Adding new users to the 6 years retention period and adding terminated users to the keep forever retention. Please advise best way to archive this goal using the adaptive scope and query that can be used.