The page could not be created. Custom Scripting might be deactivated on the destination site or you might not have sufficient permissions.

[Fixed]: The page could not be created. Custom Scripting might be deactivated on the destination site or you might not have sufficient permissions.

No comments

 6,230 total views,  2 views today

These days I have been working with the SharePoint modern communication site – and facing different types of issues. One of the issues – I have faced is “The page could not be created. Custom Scripting might be deactivated on the destination site or you might not have sufficient permissions.” while was migrating a site from a communication site to another communication site in SharePoint online but later I have found this issue not limited to migration only –  it pops up in many other ways as well. I will share this in this blog.

The page could not be created. Custom Scripting might be deactivated on the destination site or you might not have sufficient permissions.
The page could not be created. Custom Scripting might be deactivated on the destination site or you might not have sufficient permissions.

Key Highlights

  • Use cases or business scenarios about the custom scripting issue
  • What is the root cause of the custom scripting issue in SharePoint online?
  • Solution – how to fix the custom scripting issue in SharePoint online?
  • Demo – Verification

Use cases or business scenarios about this issue:

Scenario Issue# 1:

  • If you try to migrate any .aspx pages to the modern SharePoint online site using any of the third-party migration tools like Sharegate or Metalogix, we will get the above-mentioned error.

Scenario Issue# 2:

  • The second scenario could be – if you try to activate the “SharePoint Server Publishing Infrastructure” feature in the SharePoint Online modern communication site using the PnP PowerShell – the feature will be activated but we cannot see the publishing feature-capability like List templates, Themes, Solutions
    and Composed looks under the Web Designer Galleries section of the Site Settings page.

Note:

We need to keep in mind that having publishing feature enabled in the SharePoint online modern communication site is a challenge – so, please refer my previous article how to activate the SharePoint Server Publishing Infrastructure feature in the SharePoint modern communication site

list templates under web designer galleries: List templates, Themes, Solutions, and Composed looks link not showing in the web designer galleries

Generally, if we enable or activate the “SharePoint Server Publishing Infrastructure” feature, we should see the below links along with the “Site columns” and “Site content types” in the web designer galleries.

  • List templates,
  • Themes,
  • Solutions and
  • Composed looks
List templates, Themes, Solutions, and Composed looks link not showing in the web designer galleries
List templates, Themes, Solutions, and Composed looks link not showing in the web designer galleries

However, in the SharePoint modern communication site, these links don’t show up.

 Scenario Issue# 3:

For example, if you want to create a SharePoint list using the list template (.stp file) – we need to go to the List templates link from the web designer galleries section of the site settings page, and add the template (.stp file) over there – but due to this problem, we cannot do this.

So, in this kind of scenario, we as a SharePoint developer try to come up with some alternate approaches like finding the shortcut URL to upload the list template file to the gallery.

Example:

https://globalsharepoint2020.sharepoint.com/sites/TestCommunicationSite/_catalogs/lt/Forms/AllItems.aspx

If you access the above template gallery URL directly using the above shortcut URL, it will open fine but we cannot upload the template (.stp) file over there – we will get the below error message:

“This content cannot be displayed in a frame
To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame.”

This content cannot be displayed in a frame To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame
This content cannot be displayed in a frame To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame

So, we are blocked with all the ways.

What is the root cause of the custom scripting issue in SharePoint online?

The root cause of the above three issues is custom scripting. We need to activate the custom scripting feature in the issued site which we cannot activate through site UI/Navigation.

Note:

By default, the custom script is disabled in the modern SharePoint online site when it’s created in SharePoint tenant, even though if you have it enabled at the tenant level.

Solution – how to fix the custom scripting issue in SharePoint online?

To resolve this issue in Office 365 – SharePoint online, we need to activate the custom scripting using PowerShell:


$adminUserID="YourGlobalAdminAccount@yourdomain.sharepoint.com"
$userCredential = Get-Credential -UserName $adminUserID -Message "Enter password"
Connect-SPOService -Url "https://yourtenant-admin.sharepoint.com/ "-Credential $userCredential
#Example: https://globalsharepoint2020-admin.sharepoint.com
Set-SPOsite "https://yourtenant.sharepoint.com/sites/YourSiteWhereYouWantToEnableCustomScript" -DenyAddAndCustomizePages 0
#Example: https://globalsharepoint2020.sharepoint.com/sites/TestCommunicationSite

Notes:

  • It should be your tenant domain(Global Admin) account and your actual site.
  • Here I have used my test trial tenant site.
  • In Connect-SPOService pass your tenant admin URL
  • In Set-SPOsite pass the site URL where you want to enable the custom scripting.
  • If your tenant admin account has MFA (multi-factor authentication) enabled, you will get an OTP message, you need to enter that to authenticate in SharePoint online.
  • We should set Custom Script back to denied after your work(in case if you are doing the migration). To do that, we can run the same PowerShell script again, however, this time we should change the –DenyAddAndCustomizePages value to “1”. This is very important.

Demo – Verification

After enabling the custom scripting for the site using the above PowerShell script, if we revisit the same web designer galleries section of the site settings page, we can see all the below missing links:

  • List templates,
  • Themes,
  • Solutions and
  • Composed looks
List templates, Themes, Solutions, and Composed looks link showing in the web designer galleries
List templates, Themes, Solutions, and Composed looks link showing in the web designer galleries

 

Summary

Thus, in this troubleshooting technique – we have learned the below:

  • How to fix “The page could not be created. Custom Scripting might be deactivated on the destination site or you might not have sufficient permissions.” error.
  • What is the root cause of the custom scripting issue in SharePoint online?
  • How to fix the custom scripting issue in SharePoint online.
  • How to fix the “This content cannot be displayed in a frame
    To help protect the security of information you enter into this website, the publisher of this content does not allow it to be displayed in a frame.” error.
  • How to fix “List templates, Themes, Solutions, and Composed looks link not showing in the web designer galleries” issue.

You may also like the following SharePoint tutorials:

Free download SharePoint Online & Office 365 Administration eBook(238 Pages)

Get the PDF eBook from here:


 
FREE DOWNLOAD

Send download link to:

Subscribe to get exclusive content and recommendations every month. You can unsubscribe anytime.