Convert classic SharePoint site to modern communication site using PowerShell

In this SharePoint tutorial, we will discuss how to convert classic SharePoint site to modern communication site using PowerShell. After converting the site, the classic team site will look like a SharePoint modern communication site.

Here we will use PnP PowerShell as well as SharePoint Online management shell.

Note: We are not actually converting classic team site to modern communication site rather, we are enabling communication site experience on classic team sites.

By default, a SharePoint classic site looks like below:

convert classic sharepoint site to modern powershell

We will see here, how we will give a modern communication site look and feel to the above classic team site.

A SharePoint communication site is good visually compelling site, where users can share news, reports, and various other information within your organization with other users.

Important Points to remember

  • The site must be a classic team site and it should not be connected to a Microsoft 365 or Office 365 group. It should be created using STS#0 SharePoint site template.
  • The site must be a top-level site collection, not a SharePoint subsite.
  • SharePoint Server Publishing Infrastructure should not be activated at the site collection level, neither SharePoint Server Publishing should be enabled at the SharePoint site level.
  • The user running the PowerShell cmdlet should have full control permission on the SharePoint site.
  • If you want to change for the bulk site, then it is not supported, you have to one by one.
  • Even if you will see a modern home page, the site template will not be changed, it will be still STS#0.
  • You can not run the command with a publishing site, as of now it is not supported.

Convert classic SharePoint site to modern PowerShell

Now, let us see how to convert classic SharePoint team site to modern communication site using PowerShell (SharePoint Online management shell).

Microsoft provides Enable-SPOCommSite PowerShell cmdlets to enable the communication site experience in a classic team site.

Syntax:

Enable-SPOCommSite -SiteUrl https://tsinfo.sharepoint.com/sites/Classicsite1/ -DesignPackageId 96c933ac-3698-44c7-9f4a-5fd17d71af9e

Here -SiteUrl parameter will take a classic team site URL, where you want to enable the communication site experience.

And there is another optional paramter as -DesignPackageId.

-DesignPackageId parameter can have any of the below values:

  • Topic: 96c933ac-3698-44c7-9f4a-5fd17d71af9e
  • Showcase: 6142d2a0-63a5-4ba0-aede-d9fefca2c767
  • Blank: f6cc5403-0d63-442e-96c0-285923709ffc

The default value for the –DesignPackageId is 96c933ac-3698-44c7-9f4a-5fd17d71af9e.

Below is the full PowerShell cmdlets, you can run in Windows PowerShell ISE or SharePoint Online Management Shell command propmt.

Connect-SPOService -Url https://tsinfo-admin.sharepoint.com -credential bijay@tsinfo.onmicrosoft.com

Enable-SPOCommSite -SiteUrl https://tsinfo.sharepoint.com/sites/Classicsite1/ -DesignPackageId 96c933ac-3698-44c7-9f4a-5fd17d71af9e

Once you run the command, it will ask you to enter the password for the user.

Then it will ask you to press Y, to confirm that you want to go ahead with the changes.

Then the site will look like below:

convert classic sharepoint site to modern communication site
convert classic sharepoint site to modern communication site

What Actually Happens?

Let us understand what actually happened when you run the above PowerShell cmdlets.

If you will open the Site Pages document library, you can see it created a modern page and then set that modern page as the home page of the classic team site.

convert classic root sites to modern sharepoint

In fact, if you will open the Home.aspx, you will still see the classic SharePoint team site page.

Anytime you can rename the page and give a meaningful name.

To rename the page click on the ECB menu icon and then click on Rename.

convert classic sharepoint site to modern powershell

This will show you a dialog box and then you can rename a proper name.

Once you renamed, then you can click on Make homepage link to make the SharePoint classic team site home page.

Convert classic SharePoint team site to modern communication site

Custom script will not be allowed on this site.

Convert classic SharePoint team site to modern communication site using PnP PowerShell

Now, we will see the PnP PowerShell cmdlets to convert classic SharePoint team site to modern communication site.

If you have not installed the PnP PowerShell, then you can run the below cmd first.

Install-Module SharePointPnPPowerShellOnline

We can use the Enable-PnPCommSite PnP PowerShell cmdlets to convert classic sharepoint site to modern communication site.

Syntax:

Enable-PnPCommSite [-DesignPackageId <String>] [-Connection <PnPConnection>]

The command also will take an -DesignPackageId optional paramets. This will take the value like exaplained above.

Example:

Connect-PnPOnline –Url https://tsinfo.sharepoint.com/sites/Classicsite/ –Credentials (Get-Credential)

Enable-PnPCommSite

Here the -Url parameter, will take the site URL that you want to convert to communication site.

Once you run the cmd, the classic SharePoint site will be converted to a modern communication site.

This command will actually enable the modern communication site experience on a classic SharePoint team site. But make sure the site should be the top level site or root site of the site collection.

You may like the following PowerShell tutorials:

In this SharePoint tutorial, we learned how to convert classic SharePoint site to modern communication site using PowerShell and PnP PowerShell.

>