Fix SharePoint Online Permission Denied for HTML and Web Part Pages
Question details
A SharePoint Online site owner needs to edit HTML pages or Web Part Pages on a subsite but receives permission denied errors even after attempting to enable custom scripts.

- Product
- SharePoint Online
- Device & OS
- not provided
- Scenario
- The user manages a SharePoint Online subsite and must update HTML pages or Web Part Pages.
- Observed behavior
- Editing is blocked with permission denied on HTML and Web Part Pages, and enabling custom scripts from the admin center did not immediately resolve the issue.
Confirm you can sign in to the SharePoint Online Management Shell with a global administrator or SharePoint administrator account, and identify the parent site collection URL for the affected subsite before running the commands.
Enable Custom Scripting on the Parent SharePoint Site with PowerShell
Use this solution when a subsite blocks HTML or Web Part Page editing because custom scripts are disabled at the site collection level.
SharePoint Online blocks HTML and Web Part Page editing when the site collection has custom scripting disabled. Re-enabling it at the parent site collection is required even when the affected page is on a subsite.
Open PowerShell as an administrator and run Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Force -Scope CurrentUser.
Run Connect-SPOService -Url https://yourtenant-admin.sharepoint.com and sign in with an account that has global administrator or SharePoint administrator permissions.
Run Set-SPOSite <ParentSiteURL> -DenyAddAndCustomizePages 0, using the URL of the parent site that contains the affected subsite.
Allow up to 24 hours for SharePoint Online to apply the setting, then refresh the HTML or Web Part page and try editing again.

A Free Microsoft Office Alternative for Daily Document Editing
When SharePoint Online custom scripting permissions are managed by Microsoft 365, WPS Office cannot change those tenant settings. As a free, lightweight alternative, WPS Office offers familiar ribbon-based tools and strong compatibility with Microsoft Word, Excel, and PowerPoint files, so you can keep editing and sharing documents without a heavy Office installation.

Frequently Asked Questions
Why can a SharePoint site owner edit regular pages but not HTML or Web Part Pages?
HTML and Web Part Pages require custom scripting to be enabled at the site collection level. If it is disabled, SharePoint Online returns permission denied even for site owners.
Do I run Set-SPOSite against the subsite URL or the parent site URL?
Run the command against the parent site collection URL. The DenyAddAndCustomizePages setting is managed at the parent site level for its subsites.
How long do SharePoint Online custom script changes take to apply?
Changes can take up to 24 hours to apply. Wait before retesting the HTML or Web Part page, especially if the setting was enabled through the admin center.
Can I enable custom scripts from the SharePoint admin center without PowerShell?
Yes, you can use SharePoint admin center settings to allow custom scripts, but the change may take up to 24 hours and can be less immediate than the PowerShell command.
What permissions do I need to run the SharePoint Online Management Shell command?
You need a global administrator or SharePoint administrator role to connect with Connect-SPOService and run Set-SPOSite.




