SharePoint Retention Policy Change

Steve IAnson 1 Reputation point
2021-11-11T16:10:42.117+00:00

As per a recent MessageCenter notification MC289965 mirrored here: m365-records-management linked to roadmap ID 82063roadmap
Microsoft is rolling out a change to the behaviour of retention labels around deletions.

This change is being activated by default on all tenants. For those customers who wish to retain the current functionality, the article states:

To configure your tenant to continue preventing deletion of files labelled to retain from SharePoint, please utilize the SetAllowFilesWithKeepLabelToBeDeletedSPO function in the SPPolicyStoreProxy class of the SharePoint Client Object Model to set this behavior to false.

No other information is provided and googling SetAllowFilesWithKeepLabelToBeDeletedSPO returns almost nothing.
The documentation for the SPPolicyStoreProxy class is listed here: microsoft.sharepoint.client.compliancepolicy.sppolicystoreproxy and according to the documentation, no such method exists.

If you download the "SharePoint Online Client Components SDK" details.aspx and check within the assembly "Microsoft.Office.Client.Policy.Portable.dll" (as listed SPPolicyStoreProxy in the document), there is no such method.
However, if you download the latest version of PnPPowershell (currently 1.8.0), and look in a different assembly (Microsoft.Office.Client.Policy.dll), the method is there.

I've been able to create a PowerShell script to query and change the value (to false as per the message center post), however the complete lack of documentation or even reference to the method online makes me wonder if it is supported to actually make this change.

Apart from the high-level snippet from the message center post, has anyone found any documentation at all around this or can confirm the supportability of its use?

Thanks and regards

Steve

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
9,693 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Elsie Lu_MSFT 9,761 Reputation points
    2021-11-12T07:17:47.117+00:00

    Hi @StevelAnson-1312 ,

    Your situation is more comlicated than that can be handled in the forum, I would suggest you open a service request to Microsoft for more help.

    148793-120.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

  2. Omar Soboh 1 Reputation point
    2021-11-30T09:18:56.383+00:00

    Please check the below 'PnP.Powershell' sample script with necessary modules/dlls and query to set the value.

    [CmdletBinding(DefaultParameterSetName="UseCustomTermSet")]
    Param
    (
    [Parameter(Mandatory=$true)]
    $url
    )

    $module = Get-Module PnP.Powershell

    if(!$module)
    {
    Import-Module PnP.Powershell
    $module = Get-Module PnP.Powershell
    }

    $base = $module.ModuleBase

    $clientDll = [System.Reflection.Assembly]::LoadFile("$base\Core\Microsoft.SharePoint.Client.dll")

    $runtimeDll = [System.Reflection.Assembly]::LoadFile("$base\Core\Microsoft.SharePoint.Client.Runtime.dll")

    $policydll = [System.Reflection.Assembly]::LoadFile("$base\Core\Microsoft.Office.Client.Policy.dll")

    $cred = Get-Credential

    Context

    $ctx = New-Object Microsoft.SharePoint.Client.ClientContext($url)
    $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($cred.UserName, $cred.Password)

    [Microsoft.SharePoint.Client.CompliancePolicy.SPPolicyStoreProxy]::SetAllowFilesWithKeepLabelToBeDeletedODB($ctx, $true)
    [Microsoft.SharePoint.Client.CompliancePolicy.SPPolicyStoreProxy]::SetAllowFilesWithKeepLabelToBeDeletedSPO($ctx, $true)

    $ctx.ExecuteQuery()

    0 comments No comments