In SharePoint online when you try to add a property bag via pnp powershell, you will notice that you get the following error
As the error says, we need to disable NoScript property by running the following command
Set-PnPPropertyBagValue -Key "" -Value ""
PLEASE NOTE : Connect-PnPOnline command is very important, without this even you were already logged in the NoScript property cant be set to false. It sounds strange but that is what i experienced.
Set-PnPPropertyBagValue : Site has NoScript enabled, and setting property bag values is not supported
At line:1 char:1
+ Set-PnPPropertyBagValue -Key "KEY_XYZ" -V ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (SharePointPnP.P...ropertyBagValue:SetPropertyBagValue) [Set-PnPPropertyBagValue], Exception
+ FullyQualifiedErrorId : NoScriptEnabled,SharePointPnP.PowerShell.Commands.SetPropertyBagValue
As the error says, we need to disable NoScript property by running the following command
Connect-PnPOnline Site Collection URL
Set-PnPTenantSite -Url Site Collection URL -NoScriptSite:$falseAfter running the above command you should be able to add your new property bag item using the following command:
Set-PnPPropertyBagValue -Key "
PLEASE NOTE : Connect-PnPOnline command is very important, without this even you were already logged in the NoScript property cant be set to false. It sounds strange but that is what i experienced.
No comments:
Post a Comment