Is there any way to include newly created SharePoint site in an existing retention policy created in security and compliance?

or once in a month all newly created sites to be added in a current retention policy?

We do not want to add all the sites in retention policy and only want to add sites which are created by a specific user. Is this possible through any out of the box functionality? If not what could be other potential ways to do it?

1 Answer 1


You can't automatically add new sites explicitly to the retention policies out-of-the-box.

One way to automate it is to script this with PowerShell. I'm including all PowerShell commands you'll need to complete this task.

Get a list of SharePoint Online sites

Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Scope CurrentUser
Get-SPOSite -Limit ALL

Install the Exchange Online PowerShell Module

Install-Module ExchangeOnlineManagement -Scope CurrentUser

Establish a new session


Get existing retention policies

Get-RetentionCompliancePolicy -Identity "SharePoint Retention Polocy" -DistributionDetail

Add a new site to the retention policy

Set-RetentionCompliancePolicy -Identity "SharePoint Retention Polocy" -AddSharePointLocation "https://contoso.sharepoint.com/sites/teams/finance"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.