Skip to main content

Enable custom scripts

This section details the steps for enabling custom scripts on a SharePoint Online site.

This is required to enable Pro-Sapien app deployments to be executed.

There are two methods for enabling custom scripts:

  • PnP PowerShell
  • SharePoint admin center
info

The custom scripts setting is enabled for specific site collections only, and is disabled automatically 24 hours after being enabled. Timing for enabling this setting should be coordinated with Pro-Sapien.

Before you start

Parameters

The following values are required:

  • {SharePoint-Site-Url}
  • {Pnp-App-ClientId} (for PnP Powershell method only)

Permission required

Use an account with the following permissions:

  • Global or SharePoint Administrator

PnP PowerShell

Run following PowerShell script to enable custom scripts.

If PnP PowerShell is not enabled in your environment, refer to the Prepare Microsoft tenant section for guidance.

note

IMPORTANT: Variables at top of script must be updated before proceeding.

  • $PnpAppClientId: populate with {Pnp-App-ClientId}
  • $SharePointSiteUrl : populate with {SharePoint-Site-Url} for the instance

$PnpAppClientId= ""
$SharePointSiteUrl = ""

## Connect to SharePoint Site
Connect-PnPOnline -Url $SharePointSiteUrl -ClientId $PnpAppClientId -Interactive

## Enable custom scripts
Set-PnPSite -Identity $SharePointSiteUrl -NoScriptSite $false

SharePoint admin center

The following link provides steps for enabling custom scripts in the SharePoint Admin Center: