Setting "Allow users to create modern pages" will still allow users to create modern pages on modern sites

john john 1,026 Reputation points
2022-12-14T11:35:21.943+00:00

We have unchecked this checkbox 3 days ago:-

270573-image.png

now on classic site >> seems the option to create modern page will be removed:-

enter image description here

But for modern site the option is still there:-

270563-image.png

any advice how we can prevent creating modern pages on modern sites?

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Xyza Xue_MSFT 30,231 Reputation points Microsoft External Staff
    2022-12-15T02:35:22.483+00:00

    Hi @john john ,
    Note: Clear Allow users to create new modern pages, users can still add pages from other modern pages, either from the New menu or from modern webparts (such as News).
    270765-image.png
    You can prevent users from creating modern pages on a specific site by using PowerShell.
    Powershell code:

    # Load SharePoint Online Client Components SDK Module  
    Import-Module 'C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll'  
      
    # Set script constants  
    $sitePagesFeatureIdString = 'B6917CB1-93A0-4B97-A84D-7CF49975D4EC'  
      
    # Set up client context  
    $userName = Read-Host "Username"  
    $password = Read-Host "Password" -AsSecureString  
    $siteUrl = Read-Host "Site Url"  
    $webUrl = Read-Host "Server-Relative Web Url"  
    $context = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)  
    $credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $password)  
    $context.Credentials = $credentials  
      
    # Get the list of existing features  
    $web = $context.Site.OpenWeb($webUrl)  
    $features = $web.Features  
    $context.Load($features)  
    $context.ExecuteQuery()  
      
    # Verify that the Site Pages feature is present in the web  
    if(($features | ? { $_.DefinitionId -eq $sitePagesFeatureIdString }).Count -eq 0)  
    {  
        Write-Host "The Site Pages feature is already disabled in this web"  
        return  
    }  
      
    # Remove the Site Pages feature from the web  
    $features.Remove((new-object 'System.Guid' $sitePagesFeatureIdString), $false)  
    $context.ExecuteQuery()  
      
    # Verify that the Site Pages feature is no longer present in the Web  
    $web = $context.Site.OpenWeb($webUrl)  
    $features = $web.Features  
    $context.Load($features)  
    $context.ExecuteQuery()  
    if(($features | ? { $_.DefinitionId -eq $sitePagesFeatureIdString }).Count -eq 0)  
    {  
        Write-Host "The Site Pages feature has been successfully disabled"  
    }  
    else  
    {      
        throw "The Site Pages feature failed to be disabled"  
    }   
    

    Please refer to: https://learn.microsoft.com/en-US/sharepoint/let-users-create-modern-site-pages?WT.mc_id=365AdminCSH_spo


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.