SharePoint Online – Enable Custom Script

PowerShell

Per Site Collection using pnp-powershell

$siteUrl = "https://tenant.sharepoint.com/sites/site"

$siteConnection = Connect-PnPOnline $siteUrl -ReturnConnection

$tenantSite = Get-PnPTenantSite -Detailed -Url $siteUrl -Connection $siteConnection

$tenantSite.DenyAddAndCustomizePages = [Microsoft.Online.SharePoint.TenantAdministration.DenyAddAndCustomizePagesStatus]::Disabled

$tenantSite.Update()

$tenantSite.Context.ExecuteQuery()

Leave a Reply

  • Your email address will not be published.
  • Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: