Troubleshooting

Enable Custom Script in SharePoint Online

Resolve page migration errors by enabling custom script functionality in SharePoint Online.

Overview

When migrating SharePoint sites, you may encounter issues where pages fail to appear in the target environment. This commonly occurs when custom script is disabled in SharePoint Online, which blocks the migration of certain page types.

Error Message

Migration Error

"Blocking web file because NoScript=true, list item ID: [ID], destination library ID: [ID]"

This error indicates that SharePoint Online is blocking the migration of files that contain scripts or custom code because the NoScript setting is enabled.

Cause

SharePoint Online has a security feature called "Custom Script" that controls whether users can run custom scripts on sites. By default, this feature may be disabled on certain site types for security reasons.

Affected Content

When custom script is disabled, the following content types may be blocked during migration:

  • Custom web parts
  • Pages with embedded scripts
  • Master pages with custom code
  • Certain ASPX pages

Solution

Enable custom script on the target SharePoint site collection to allow page migrations to complete successfully.

Security Consideration

Enabling custom script allows users to run custom code on the site. Consider the security implications and disable this setting after migration if it's not needed.

Option 1: SharePoint Admin Center

  1. 1 Go to the SharePoint Admin Center
  2. 2 Navigate to SitesActive sites
  3. 3 Select the target site collection
  4. 4 Click Settings in the toolbar
  5. 5 Under Custom Script, select Allow

Option 2: PowerShell

Use SharePoint Online Management Shell to enable custom script:

# Connect to SharePoint Online
Connect-SPOService -Url https://yourtenant-admin.sharepoint.com

# Enable custom script on a specific site
Set-SPOSite -Identity https://yourtenant.sharepoint.com/sites/targetsite -DenyAddAndCustomizePages $false

Option 3: Tenant-Wide Setting

To enable custom script for all new sites:

# Enable custom script tenant-wide
Set-SPOTenant -DenyAddAndCustomizePages $false

Propagation Time

Changes to custom script settings can take up to 24 hours to propagate. Plan your migration accordingly.

Verification

After enabling custom script:

  1. 1 Wait up to 24 hours for the setting to propagate
  2. 2 Verify the setting using PowerShell:
Get-SPOSite -Identity https://yourtenant.sharepoint.com/sites/targetsite | Select DenyAddAndCustomizePages

The value should be False when custom script is enabled.

Expected Result

  • Pages migrate without NoScript errors
  • All site pages appear in the target location
  • Custom web parts function correctly

Post-Migration

Consider disabling custom script after migration completes if your organization requires this setting to be off for security compliance.

Was this article helpful?

We value your feedback

Help us improve your experience

What would you like to share with us?

Need direct support? Open a ticket