In this article, we will review the case when, during the SharePoint Site upload, the following warning (when launching upload) or an error (on the upload summary page) occurs:
- Warning: Service account does not have "Add and customize pages" permission;
- Error: Upload failed "Add and customize pages" permission denied.
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. This setting restricts users from creating custom scripts, custom pages, solutions, etc. Thus, when this option is set to "Blocked", the account you are using to perform site upload in FluentBooks cannot create (upload) solutions, custom views, forms, etc.
Starting from June 2024, this setting is set to "Blocked" by default for all users and all sites within your site collection.
Features affected
When the "Custom script" option is "Blocked", FluentBooks will not be able to upload Site Templetaes (Solutions), all aspx files, affects the upload of PDP, custom forms and views, etc.
For more details, please refer to the Microsoft Documentation: Features affected when custom script is blocked.
Solution
Solution 1
To resolve this issue, the Tenant Administrator of the SharePoint Site Collection must set the "Custom script" setting to "Allowed".
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.
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 migration.
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/testpwa -DenyAddAndCustomizePages $false
Additionally, you can check the results of command execution by running:
To check the status of the setting:
Get-SPOSite -Identity https://<TENANTNAME>.sharepoint.com/sites/testpwa | Select DenyAddAndCustomizePages
To change the setting to "Allowed" for more than 24 hours":
Set-SPOTenant -DelayDenyAddAndCustomizePagesEnforcement $True
To set the "Custom script" setting to "Blocked" again after the migration is over:
Set-SPOSite -Identity https://<TENANTNAME>.sharepoint.com/sites/testpwa -DenyAddAndCustomizePages $true