The page could not be created. Custom Scripting might be deactivated on the destination site – 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 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.

Key Highlights: The page could not be created
- 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 the publishing feature enabled in the SharePoint online modern communication site is a challenge – so, please refer to 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

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 developers 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.”

So, we are blocked in all 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 (enable custom script 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: The page could not be created
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

Summary: The page could not be created
Thus, in this troubleshooting technique – we have learned the below:
- How to fix the “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 the “List templates, Themes, Solutions, and Composed looks link not showing in the web designer galleries” issue.
See Also: SharePoint online tutorial for beginners step by step
You may also like the following SharePoint tutorials:
- [Fixed] Error – activate the SharePoint Server Publishing Infrastructure feature in SharePoint Online site
- SharePoint Online: private vs public office 365 groups in SharePoint online site
- Export SharePoint user information list to CSV(Excel) file using PowerShell
- [Verified] How to redirect the specific user to a different page in SharePoint online?
- FAQ: SharePoint learning route for a junior developer(SharePoint skills matrix)
- Create custom property in SharePoint Framework – SPFx web part pane
- Understanding solution structure in SharePoint framework (SPFx)
- Develop your first hello world web part in sharepoint framework (SPFx)
- Column header formatting in SharePoint list Quick Edit or Datasheet View
- Enable and configure information rights management (IRM) in SharePoint Online
- Manage recycle bin in SharePoint Online – Office 365
- In 4 steps create office 365 trial account – sign up free subscription
- Add more than 5 conditions in InfoPath form’s rule
- How to validate the date column in Infopath form
- How to a copy list item to another list using SharePoint designer workflow
- SharePoint Framework (SPFx) development environment Setup step by step
- 3 ways add a picture library in the communication site – SharePoint Online
- SharePoint generation or version history from the year 2000 to 2020
- Office 365: Getting started with SharePoint PnP PowerShell – installation
- In 2 steps convert a classic SharePoint page to modern using PnP
- Office 365: Retrieve hub sites and associated sites using PnP Powershell
- Create a modern team site using PnP PowerShell in SharePoint
- In 4 steps access SharePoint online data using postman tool
- SharePoint admin center: Learn SharePoint online administration in an hour – step by step
- SharePoint REST API: GET vs POST vs PUT vs DELETE vs PATCH
- Office 365: Understanding the hub site in SharePoint online
- Create SharePoint online list using PnP provisioning template
- List Template IDs In SharePoint Online/SharePoint 2019/2016/2013/2010/2007
- Allow or prevent custom script

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