Tag: PnP

  • Set Retention Label with Metadata PowerShell

    ListItem.SetComplianceTagWithMeta Using PowerShell PnP to set Retention Label with labelled date. Not for use in Production but handy for testing. https://learn.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.client.listitem.setcompliancetagwithmetainfo?view=sharepoint-csom connect-pnponline -url <url> -UseWebLogin $context = Get-PnPContext $files = get-pnplistitem -List <ListName> $file = $files[<id>] $complianceTagWrittenDate = (Get-Date -Month 1 -Day 1 -Year 2000) $file.SetComplianceTagWithMetaInfo($labelName, $isPolicyHold, $isPolicyRecord, $complianceTagWrittenDate, $userEmailAddress, $false) $context.ExecuteQuery()