SharePoint Online: How to Prevent Users from Editing Pages?

Requirement: Disable the ability to edit site pages in SharePoint Online from site members.

How to Prevent Users from Editing Pages in SharePoint Online?

By default, members of the SharePoint Online site can edit any page, including the Home page. At times, this creates unnecessary issues, and we wanted to stop users from editing site pages. So, the overall idea here is: Break permission inheritance of the “Site Pages” library, edit the permissions of the default members group of the site by removing “Edit” permissions and add “Read” permissions to them.

Here is the step-by-step procedure to stop users from editing site pages.

  1. Browse to your SharePoint site >> Click on Settings Gear >> Choose “Site Contents”
  2. Click on “Site Pages” from the list of available lists and libraries.
  3. Click on the settings Gear >> Choose “Library Settings”.
  4. Under the library settings page, click on “Permissions for this document library”.
  5. Now, We have to break permission inheritance. Click on “Stop Inheriting Permissions”.prevent users from editing site pages in sharepoint online
  6. Locate and select the checkbox next to the Members Group of the site, in my case its “Operation Site Members” as I’m in the “Operations” site.
  7. Click on “Edit User Permissions” button in the ribbon.sharepoint online disable edit page
  8. In the edit user permissions page, uncheck the checkbox next to Edit and check it for “Read”.sharepoint online prevent users from editing pages
  9. Click on OK button to save your changes.

So now, We have removed edit permissions from members of the site and granted read permissions so that users won’t be able to edit the page while they still have read access to browse through.

Please note, if the members group has any other permissions like contribute, You have to remove those permissions too!

PowerShell to prevent users from editing pages in SharePoint Online

The above steps can be automated with the help of PowerShell as:

#Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/Operations"
$ListName = "Site Pages"

Try {
    #Connect to PnP Online
    Connect-PnPOnline -Url $SiteURL -Interactive

    #Get the Default Members Group 
    $MembersGroup = Get-PnPGroup -AssociatedMemberGroup

    #Break Permission Inheritance of the List
    Set-PnPList -Identity $ListName -BreakRoleInheritance -CopyRoleAssignments

    #Remove "Edit" permission from the list
    Set-PnPGroupPermissions -Identity $MembersGroup -List $ListName -RemoveRole "Edit"

    #Grant "Read" permission to the Group
    Set-PnPListPermission -Identity $ListName -AddRole "Read" -Group $MembersGroup

    Write-Host "Removed 'Edit' Permissions and Granted 'Read' on 'Site Pages' to $($MembersGroup.Title). " -foregroundcolor Green
}
Catch {
    write-host -f Red "Error Setting Permissions!" $_.Exception.Message
}

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. Passionate about sharing the deep technical knowledge and experience to help others, through the real-world articles!

One thought on “SharePoint Online: How to Prevent Users from Editing Pages?

Leave a Reply

Your email address will not be published. Required fields are marked *