Permission & Access Issues

Fix SharePoint Online Permission Denied for HTML and Web Part Pages

Camila MilosovichCamila Milosovich Nov 13, 2026 868 views

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.

Fix SharePoint Online Permission Denied for HTML and Web Part Pages
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.
Before you start

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.

Solution 1Recommended

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.

1
Install the SharePoint Online Management Shell

Open PowerShell as an administrator and run Install-Module -Name Microsoft.Online.SharePoint.PowerShell -Force -Scope CurrentUser.

2
Connect to SharePoint Online as an admin

Run Connect-SPOService -Url https://yourtenant-admin.sharepoint.com and sign in with an account that has global administrator or SharePoint administrator permissions.

3
Allow custom scripts on the parent site collection

Run Set-SPOSite <ParentSiteURL> -DenyAddAndCustomizePages 0, using the URL of the parent site that contains the affected subsite.

4
Wait for the change to take effect

Allow up to 24 hours for SharePoint Online to apply the setting, then refresh the HTML or Web Part page and try editing again.

Enable Custom Scripting on the Parent SharePoint Site with PowerShell
This applies to the parent site collection: For a subsite, the -DenyAddAndCustomizePages 0 command must be run against the parent site URL, not the subsite URL.
Free Microsoft Office alternative

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.

Avoid SharePoint Online custom-script permission blockers for routine file editing and local collaboration.Preserves compatibility with Microsoft Word, Excel, and PowerPoint file formats.Free and lightweight Office suite with a familiar, easy-to-use interface.Seamless migration from Microsoft Office documents without losing common formatting.
microsoft office alternative - wps office

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.