Deleting Retention Policy Enabled Sharepoint Sub Sites

Office 365 Security Owner todayJuly 29, 2019 437 5

share close

Creating sub sites is a way for all site owners to test certain programs and theories that they have cooking up. But if you have enabled Retention policy from the compliance and security portal then you might find some difficulty in deleting sub sites. Some users have reported that same issue too. So here is how you can delete sub sites whilst having Retention Policy enabled.

Deleting Retention Policy Enabled SharePoint Sub Sites

  1. The following PowerShell script is used to make an exception in the famous Retention Policy:
#M365 Global Admin Credential 
$UserCredential = Get-Credential
#Connect to Office 365 Security & Compliance Center
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -DisableNameChecking
#list of Sharepoint Sites for RTP exception
$Sites = Import-Csv C:\Sites.csv
#Add Sites in RTP Exception 
$Sites | foreach 
{Set-RetentionCompliancePolicy -AddSharePointLocationException $_.Site -Identity "Sharepoint_Onedrive Retentions"}
#Remove-PSSession $Session

Written by: Owner

Tagged as: .

Rate it

Previous post