You can enable and disable custom scripting in the SharePoint Online site collection. With the modern UI sites, Microsoft by default disabled the custom scripting as the development is encouraged via SharePoint Framework (SPFx). For the classic sites by default, the custom scripting is turned on. So, the below features are blocked when the custom scripting is disabled:
- Many web parts including content editor, script editor, etc are disabled.
- Uploading files that potentially include scripts are blocked
- SharePoint Designer script changes not allowed
- Save Site as Template, Save document library as template links disabled
- Solution Gallery, Sandbox Solutions, Theme Gallery, HTML Field Settings are not available
- All other script-related featured are turned off
Please note that using tenant settings the custom scripting for self-service sites is enabled / disabled for all. Using PnP PowerShell module, the custom scripting can be enabled or disabled on site by site basis.
PnP PowerShell to Enable Custom Scripting in SharePoint Online:
#Import the correct PnP module. The module name is SharePointPnPPowerShellOnline
Import-Module SharePointPnPPowerShellOnline -Verbose
#Set Variables
$SiteURL="https://contoso.sharepoint.com/sites/mysite"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -UseWebLogin
#sharepoint online allow custom scripts powershell
Set-PnPSite -Identity $SiteURL -NoScriptSite $false
For reference regarding Activate Custom Script for SharePoint 2019, please read the following article.
Comments