I have a requirement to add sensitivity label to document libraries of multiple site collections.
I found below PnP PowerShell Command as per https://pnp.github.io/powershell/cmdlets/Set-PnPList.html
Set-PnPList -Identity "Demo List" -DefaultSensitivityLabelForLibrary "Confidential" -Connection $ModernSiteConnection
$ModernSiteConnection = Connection establish using certificate and working for other operations like applying sensitivity label to site collection.so no issue with connection
but the above command for applying sensitivity Label for Document library is not working saying A parameter cannot be found that matches parameter name 'DefaultSensitivityLabelForLibrary' even i can not see DefaultSensitivityLabelForLibrary in intelligence while other all parameter i can see and tried one of those like EnableContentTypes it worked.
I am using 2.2.1 version of pnp.powershell
can you please help me to understand what is the problem.
Trying to add sensitivity label to document library using pnp powershell Set-PnPList -Identity $LibraryName -DefaultSensitivityLabelForLibrary "Restricted" -Connection $ModernSiteConnection
but getting error A parameter cannot be found that matches parameter name 'DefaultSensitivityLabelForLibrary'
I think there is some version conflict in the PnP PowerShell modules/versions installed on your system.
I think the current stable & latest of PnP PowerShell is
v2.2.0
.And
DefaultSensitivityLabelForLibrary
parameter ofSet-PnPList
cmdlet was added to PnP PowerShell inv2.1.0
.Try below steps once:
Uninstall all versions of
SharePointPnPPowershellOnline
module from your system.Uninstall all versions of PnP PowerShell modules from your system
Install the latest and stable version (
v2.2.0
) of PnP PowerShell by following below documentationsDocumentations: