Forum Discussion

Odd Arne Nohr's avatar
Odd Arne Nohr
Copper Contributor
Mar 07, 2017
Solved

Enable modern site pages

In my tenant i have several site collcetions, but for some of them i cant create modern site pages.

 

Is there anye Site features that has to be enabled disabled to get the modern site pages?

Or is there another explanation to this?

 

Thanks

  • I had the same problem. I had to activate the SitePage feature in the site settings (see attached pic)

14 Replies

  • Hi 

    Below powershell script worked for me.. I got it from microsoft technical team.

     

    # 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 not present in the web
    if(($features | ? { $_.DefinitionId -eq $sitePagesFeatureIdString }).Count -gt 0)
    {
    Write-Host "The Site Pages feature is already enabled in this web"
    return
    }

    # Add the Site Pages feature back to the web
    $features.Add((new-object 'System.Guid' $sitePagesFeatureIdString), $false, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)
    $context.ExecuteQuery()

    # Verify that the Site Pages feature is now present in the web
    $web = $context.Site.OpenWeb($webUrl)
    $features = $web.Features
    $context.Load($features)
    $context.ExecuteQuery()

    if(($features | ? { $_.DefinitionId -eq $sitePagesFeatureIdString }).Count -gt 0)
    {
    Write-Host "The Site Pages feature has been successfully enabled"
    }
    else
    {
    throw "The Site Pages feature failed to be enabled"
    }

     

    • Pieter Op De Beéck's avatar
      Pieter Op De Beéck
      Iron Contributor

      Hi, from a functional perspective, what exactly does this script do? Does it enable a certain feature or does it directly make a specific site collection as root site collection ... ?

       

      Thanks for your feedback!

      • Rajashekhar Sheelvant's avatar
        Rajashekhar Sheelvant
        Brass Contributor

        This script enables the feature in the target site. With PNP powershell cmdlets we can achieve this just in few lines. Please refer to the script using pnp cmdlets below.

         

        # Connect to a site
        $cred = Get-Credential
        Connect-PnPOnline -Url <Site URL> -Credentials $cred

         

        # Enable site pages feature at web
        Enable-PnPFeature -Identity B6917CB1-93A0-4B97-A84D-7CF49975D4EC -Scope Web

         

  • Jérôme Leloup's avatar
    Jérôme Leloup
    Copper Contributor

    I had the same problem. I had to activate the SitePage feature in the site settings (see attached pic)

    • Levi Johnson's avatar
      Levi Johnson
      Brass Contributor

      I also just discovered that if you enable SharePoint Server Publishing in Site Features, you cannot create the new modern pages in your site. If you disable it, it works right away.

  • If modern experience is the default one in the tenant (you can check this on the SPO tenant settings), you don't need to enable at a site collection level...but bear in mind that if you have any customizations in your site collections, it could happen that the new stuff is not exposed to you...in those site collections: do you see the classic UI or the new one for Document Libraries?
    • Odd Arne Nohr's avatar
      Odd Arne Nohr
      Copper Contributor

      In all the site-collection I have the modern layout on list and libraries.

       

      I use the gear in top right corner and choose Add new page, on some sites it opens a modern page but for some it only give me option to set page name.

      • jcgonzalezmartin's avatar
        jcgonzalezmartin
        MVP
        Do you have any customizations applied to those sites where you are trying to create a modern page? Any feature you have enabled there? Which templates are the sites based on?

Resources