Open stvpwrs opened 1 year ago
Hey @stvpwrs I've been looking into this for a project I'm doing and it's certainly possible using the Graph API here: https://learn.microsoft.com/en-us/graph/api/driveitem-assignsensitivitylabel?view=graph-rest-1.0&tabs=http
However, the assignSensitivityLabel endpoint is a premium API at a cost of $0.00185 (USD) per API call which will need to be enabled in Microsoft Graph. Therefore I'm not sure if adding a command will be helpful to most, however you could use PnP to run the Invoke-PnPGraphMethod
calls.
You can also set the default Sensitivity Label for a Library running the Set-PnPList -DefaultSensitivityLabelForLibrary
command
Thanks @danielcecil . I think that makes sense. I do assume that more API calls will become premium overtime and I think PnP should have a strategy for how to deal with those APIs. Even if that is to call back to just calling the Graph API directly.
Thanks @stvpwrs I've opened a discussion about this #3446, because I'm keen to build the cmdlet. For now you could use Invoke-PnPGraphMethod to call the Graph API directly.
@danielcecil - just ship it 😊
Lets not worry about checking license and stuff. If the cmdlet is able to assign sensitivity label , that would be enough for v1/beta release of the cmdlet.
If tenant doesn't have that capability , Graph will throw error anyway.
For getting started : https://pnp.github.io/powershell/articles/gettingstartedcontributing.html
If possible it would be very helpful to assign Sensitivity Labels on files with PowerShell.
Describe the solution you'd like Ideally it would be a simple cmdlet like Add-PnPFileSensitivityLabel that takes a path and then assigns a sensitivity label.
Describe alternatives you've considered There are OOTB features for setting defaults on libraries and on containers, but there isn't really much in terms of files and I think most alternatives are covered with existing OOTB features or cmdets.