Forum Discussion
HeyBeer
Nov 13, 2023Copper Contributor
Auto-Label Sharepoint Folder
Hello,
I'm wanting an auto-label policy to apply a sensitivity label to a particular folder within a sharepoint library. I'm lead to believe this is possible using KQL and the 'DocumentLink' document property (which is a managed property). Writing a rule with the following syntax results in a bunch of files being found in the simulation, but when I run it no labels are applied (even several weeks later).
DocumentLink:https://xxxxxx.sharepoint.com/sites/xxxx/Particular Folder/*
Any idea whether there is another way to achieve this, or why this isn't working?
Cheers
- vicwingsingBrass Contributorhi HeyBeer,
KQL is not the tool that you would use for this. You can either use the set-label command (https://learn.microsoft.com/en-us/powershell/module/exchange/set-label?view=exchange-ps)
The other option was recommended in this thread: https://techcommunity.microsoft.com/t5/sharepoint-developer/update-sensitivity-labels-for-documents-powershell/m-p/3821448 where Shijuraj recommended using Graph API to assign a label using driveItem: https://learn.microsoft.com/en-us/graph/api/driveitem-assignsensitivitylabel?view=graph-rest-beta&tabs=http