Missing Classic Pages, and Script editor webpart missing in SharePoint Online


You have a modern site in SharePoint Online, but you want to get a classic page with a script editor webpart. The problem is all of this is missing! Use the PowerShell script below to enable the features required to support this. 

Remember that Communication sites do not support this, only Team sites!

Import-Module PnP.Powershell

$SiteURL = "https://contoso.sharepoint.com/sites/MYMODERNSITE"

Connect-PnPOnline $SiteURL -Interactive

$Template = Get-SPOSite -Identity $SiteURL -detailed | Select -ExpandProperty template

if($Template -eq "SITEPAGEPUBLISHING#0"){Write-Host "SharePoint Communication Sites (publishing) do not allow script editor webparts. Recreate the site as a Team site"}


    Write-Host "Enabling site features to support script editor webparts"

    SharePoint Server Publishing Infrastructure of Site Collection 

    Enable-PnPFeature -Identity f6924d36-2fa8-4f0b-b16d-06b7250180fa -force -Scope site  

    #SharePoint Server Publishing of Site  

    Enable-PnPFeature -Identity 94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb -force -Scope web 

    Set-SPOsite $SiteURL -DenyAddAndCustomizePages 0

    Set-PnPSite -Identity $SiteURL -NoScriptSite $false

    Set-PnPTenantSite -Identity $SiteURL -DenyAddAndCustomizePages:$false



Share on Google Plus

About Tom DeMeulenaere

Highly accomplished information technology professional with extensive knowledge in System Center Configuration Manager, Windows Server, SharePoint, and Office 365.
    Blogger Comment


Post a Comment

Note: Only a member of this blog may post a comment.