Set-PnPLabel -- -SyncToItems $true not changing the setting for applying to existing documents
Reporting an Issue or Missing Feature
When using the parameter -SyncToItems and setting the value to $true or 1. The setting "Apply label to existing items in the library" isn't changed and items within the folder don't have their labels updated
Expected behavior
when setting the parameter to true I'd expect the list setting "Apply label to existing items in the library" to show true and the labels on items to be updated
Actual behavior
Nothing changes and everything remains unticked

Steps to reproduce behavior
Please include complete code samples in-line or linked from gists
Connect to an office 365 sharepoint site and run:
Set-PnPLabel -List "Test" -Label "sp test" -SyncToItems $true
Which version of the PnP-PowerShell Cmdlets are you using?
- [ ] PnP PowerShell for SharePoint 2013
- [ ] PnP PowerShell for SharePoint 2016
- [x] PnP PowerShell for SharePoint Online
What is the version of the Cmdlet module you are running?
3.5.1901.0
How did you install the PnP-PowerShell Cmdlets?
- [ ] MSI Installed downloaded from GitHub
- [x] Installed through the PowerShell Gallery with Install-Module
- [ ] Other means
Has their been any update to this issue? Still having the same problem described above. Thanks.
Bumping on this thread as I referenced an issue that was created on office-docs-powershell repo about the same thing described here.
Hi, Is there any update on this issue? I have dowloaded the latest version of PnP but this issue still exists.
Any update on this issue? The issue still exists.
Hi joannecklein,
No response on this. I ended up writing a PowerShell code which works fine!
Not going to post the whole code but just to give you an idea, add Microsoft.Office.Client.Policy.dll assembly, connect to SharePoint site, create client context object, declare required variables and use the following code
$list = $context.Web.Lists.GetByTitle($listName) $context.Load($list) $context.Load($list.RootFolder) $context.ExecuteQuery()
$listUrl = $list.RootFolder.ServerRelativeUrl [Microsoft.SharePoint.Client.CompliancePolicy.SPPolicyStoreProxy]::SetListComplianceTag($context,$listUrl,$defaultLabel,$false,$false,$true) $context.ExecuteQuery()
I hope this helps you and the others!
Thanks KashifMajeed24 ! This helps a lot... thank you very much! I also came across this TechCommunity post to address the programmatic setting of it: https://techcommunity.microsoft.com/t5/Microsoft-SharePoint-Blog/Scripted-Application-of-Data-Governance-Labels/ba-p/242412
Sorry for the delay in response, was not aware of this issue.
The cmdlet is now being fixed, it was stupid mistake from my side (passing in the wrong variable in the call)
Please note that the checkbox in the UI page will never be set properly, even using the UI checkbox does not remain checked. Though, the functionality works regardless of this checkbox value.