Redigera

Dela via


Enable the communication site experience on classic team sites

A SharePoint communication site is a great tool for sharing information with others in your organization. Your users can share news, reports, statuses, and other information in a visually compelling format. Now, any classic team site can have this capability too. By running a PowerShell cmdlet, you can bring modern communication site features to your classic team sites.

Requirements

  • The site must be a classic team site that's not connected to a Microsoft 365 group (the STS #0 (Team site classic experience) site template).
  • The site must be the top-level site in the site collection. It can't be a subsite.
  • The user who runs the PowerShell cmdlet must have full owner permission on the target site.
  • The site must not have SharePoint Server Publishing Infrastructure enabled at the site collection level or SharePoint Server Publishing enabled at the site level. Learn how to enable and disable publishing features. If these features were previously enabled but are now deactivated, go to the site contents page and make sure it doesn't still contain a Pages library. Learn more about features enabled on a publishing site.

Effects of this change

  • A new modern page is created in the site and set as the home page. To see the changes, open the site in a new tab .
  • Any user that has access to the site sees the new home page with the default web parts and content immediately. Until you're ready to launch the new communication site experience, you can change the home page back to the former page.
  • Full width pages with horizontal navigation are available. (The top navigation from classic view is hidden, but can be seen on classic pages like the site settings page.) You can now customize the navigation on this site.
  • Custom script isn't allowed on the site.
  • Minor versioning on the Site Pages library is enabled. Learn more about versioning
  • Site Pages are the default content type in the Site Pages library
  • No site permissions are changed.
  • The SharePoint lists and libraries experience isn't changed.
  • Any content types enabled in the site aren't changed.
  • If the classic site collection had subsites, they aren't changed.
  • If you plan to launch this site as a high traffic portal or share the site with a large number of users, make sure to follow the portal launch guidelines.

Run the PowerShell cmdlet

You can use either the SharePoint Online Management Shell OR SharePoint PnP PowerShell to enable the communication site experience on a classic team site. We recommend that you test the experience with a minimally used classic site before running it on popular classic sites in your organization.

Important

After you enable the communication site experience on a classic site, you can't undo the change.

SharePoint admin instructions

  1. Download the latest SharePoint Online Management Shell. Version 20122.1200 or later is required.

    Note

    If you installed a previous version of the SharePoint Online Management Shell, go to Add or remove programs and uninstall "SharePoint Online Management Shell."

  2. Connect to SharePoint as a global admin or SharePoint admin in Microsoft 365. To learn how, see Getting started with SharePoint Online Management Shell.

  3. Run the following command:

    Enable-SPOCommSite -SiteUrl <URL of target site>
    

For more info about this cmdlet, see Enable-SPOCommSite.

Site admin instructions

  1. Learn how to use SharePoint PnP PowerShell commands.

  2. In Windows 10, run the following commands in PowerShell:

    Install-Module SharePointPnPPowerShellOnline
    Connect-PnPOnline –Url <Url of Targetsite> –Credentials (Get-Credential)
    Enable-PnPCommSite
    

Frequently asked questions

Will this cmdlet change all my classic sites?

  • No. The cmdlet can be run on one site at time.

Will this cmdlet change the site template?

  • No. The cmdlet enables communication site features, but the site still has the STS#0 site template. The site continues to appear as "Team site (classic experience)" in the SharePoint admin center.

Why can't I use this cmdlet on publishing sites?

  • The modern communication site experience isn't compatible with SharePoint Server publishing features.

Can I run this command on the root site in my organization?

  • Yes, if you meet the requirements listed at the beginning of this article.

How can I get a list of all classic sites that have the communication site experience enabled?

function Get-CommsiteEnabledSites{

    $adminUrl = Read-Host "Enter the Admin URL of O365 (eg. https://<Tenant Name>-admin.sharepoint.com)"
    $userName = Read-Host "Enter the username of O365 (eg. admin@<tenantName>.onmicrosoft.com)"
    $password = Read-Host "Please enter the password for $($userName)" -AsSecureString

    # set credentials
    $credentials = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $password
    $SPOCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $password)

    #connect to to Office 365

    try{

        Connect-SPOService -Url $adminUrl -Credential $credentials
        write-host "Info: Connected succesfully to Office 365" -foregroundcolor green

    }

    catch{

        write-host "Error: Could not connect to Office 365" -foregroundcolor red
        Break connectToO365

    }
    get-siteCollections
}



function get-siteCollections{

    write-host "----- List of classic sites with comm site feature enabled  -------" -foregroundcolor green

#Get all site collections
    $siteCollections = Get-SPOSite

    #loop through all site collections
    foreach ($siteCollection in $siteCollections){

        #set variable for a tab in the table
        $pixelsweb = 0
        $pixelslist = 0
        $enabledCommSite = Get-SPOIsCommSiteEnabled($siteCollection.url)
        $background = "white"
        if($enabledCommSite -ne ""){
            $background = "cyan"
        }
    }
}

function Get-SPOIsCommSiteEnabled($url){

    #fill metadata information to the client context variable
    $featureID = "f39dad74-ea79-46ef-9ef7-fe2370754f6f"
    $context = New-Object Microsoft.SharePoint.Client.ClientContext($url)
    $context.Credentials = $SPOcredentials
    $web = $context.Web
    $context.Load($web)
    $context.load($web.Features)

    try{

        $context.ExecuteQuery()
        $isCommSiteEnabled = $web.Features | Where {$_.DefinitionID -eq $featureID}
        $webTemplate = $web.WebTemplate

        if($webTemplate -ne "SITEPAGEPUBLISHING" -AND $isCommSiteEnabled){
            write-host "Found $($web.url)" -foregroundcolor green
            return "Enabled"

        }
    }
    catch{

        write-host "Could not find web" -foregroundcolor red

    }

    return ""
}

Get-CommsiteEnabledSites

See also

For info about automatically modernizing the home page on classic sites, see Classic home page modernization.