FluentPro Help Center

What do you need help with?

"Upload failed "Add and customize pages" permission denied" error on SharePoint Site restore or copy

In this article, we will review the case when the "Upload failed "Add and customize pages" permission denied" error occurs on SharePoint Site restoration or copying. This error can be found on the summary page of the completed operation (Operation Details page -> Summary Information) and the log files of the Restore SharePoint Sites or Copy SharePoint Sites operations.


Cause

This happens because the "Custom script" option is set to "Blocked" for the whole SharePoint Site collection in the Settings of the SharePoint admin center. Starting from June 2024, this setting is set to "Blocked" by default for all users and all sites in your SharePoint Site collection.

When this feature is "Blocked", G.A. Suite will not be able to restore/copy Site Templetaes (Solutions), all aspx files, custom forms and views, etc. 

For more details, please refer to the Microsoft Documentation: Features affected when custom script is blocked


Solution

Solution 1

Before restoring/copying SharePoint Sites, the Tenant Administrator of the SharePoint Site Collection must set the "Custom script" setting to "Allowed" for restoration/copy to be completed successfully. 

For this, the Tenant Administrator should navigate to the SharePoint admin center -> Active Sites -> Select the site in question -> Open the Settings page -> Click Edit under the  "Custom script" setting. 

Select "Allowed" and save the changes. 

Delete

When the custom script setting is "Allowed", it will automatically switch back to "Blocked" within 24 hours. So, it is essential to set it to "Allowed" again if the restoration/copy of SharePoint Sites using G.A. Suite is still in progress. 


Solution 2

Alternatively, the Tenant Administrator can provide the following parameter in the PowerShell script to extend the period of this setting. However, Microsoft will disable this option in November 2024

Please note: To get started using PowerShell in SharePoint Online, you need to install the SharePoint Online Management Shell and connect to SharePoint Online. Please refer to this article for more details. 

Please note: The URLs below serve as examples; you need to change them to the URL of the target SharePoint Site selected for restoration/copy. 

To connect to the Admin site of the tenant: 

Connect-SPOService -url https://<TENANTNAME>-admin.sharepoint.com

To change the settings to "Allowed":

Set-SPOSite -Identity https://<TENANTNAME>.sharepoint.com/sites/<PWANAME> -DenyAddAndCustomizePages $false



Additionally, you can check the results of command execution by running:

Get-SPOSite -Identity https://<TENANTNAME>.sharepoint.com/sites/<PWANAME> | Select DenyAddAndCustomizePages

Also, if you are using the latest version of Microsoft.Online.SharePoint.PowerShell module, you can temporarily disable the 24-hour reset of this setting by running:

Set-SPOTenant -DelayDenyAddAndCustomizePagesEnforcement $True

We cannot guarantee this will work for your tenant since Microsoft only promised this setting would be available until November 2024.

To get the latest version of Microsoft.Online.SharePoint.PowerShell module, you can run this from the PowerShell console launched with the "Run as Administrator" option:

Update-Module -Name Microsoft.Online.SharePoint.PowerShell


Was this article helpful?

Table of contents

    Back To Top