SharePoint Online: How to Replace Classic Root Site Collection with a Modern Site?

Requirement: Convert SharePoint Online Root site collection from classic to modern experience! Our requirement is, We built a new Intranet based on a Modern SharePoint Communication site and want to swap into the root site.

How to change the root site from classic to modern Experience?
As SharePoint Online root site collection is created as a classic experience site by default, we had no options to migrate from classic to modern (and we can't delete and re-create the root site!). Well, not anymore! We can replace it with another modern site using Invoke-SPOSiteSwap cmdlet. The newly introduced Invoke-SPOSiteSwap cmdlet can be used to migrate SharePoint Online site from classic to modern.
sharepoint online change root site to modern
Make sure you have the latest PowerShell module for SharePoint Online is installed (16.0.8812.1200 or later). To get the installed PowerShell module version, use:
(Get-Module -Name Microsoft.Online.SharePoint.PowerShell).Version.ToString()  

Step 1: Create a new modern site collection and customize it as per your requirements.

Step 2: Execute the Invoke-SiteSwap cmdlet to start replacing old site with the new One
Here is the PowerShell script to swap a new site in the place of old site collection. As its name suggests, the Invoke-SPOSiteSwap cmdlet swaps a site collection with another one, while taking a backup of the source site collection. Also, it creates a site redirect at the source location to the target location (unless you disable it with -DisableRedirection switch!).
#Set Parameters
$AdminCenterURL="https://crescent-admin.sharepoint.com"
$SourceSiteURL = "https://crescent.sharepoint.com/sites/intranet" #Newly built intranet
$TargetSiteURL = "https://crescent.sharepoint.com/" #Existing Intranet Site
$ArchiveSiteURL = "https://crescent.sharepoint.com/sites/Intranet-archive" #Backup for existing Intranet
 
#Connect to SharePoint Online
Connect-SPOService -Url $AdminCenterURL -Credential (Get-Credential)

#Start Site Swap
Invoke-SPOSiteSwap -SourceUrl $SourceSiteURL -TargetUrl $TargetSiteURL -ArchiveUrl $ArchiveSiteURL
Please note, The source and target sites can't be connected to an Office 365 group. They also can't be hub sites or associated with a hub (Remove the Hub site association prior swap and then re-associate). Typically it takes few minutes to complete. All subsites contained with the source and target sites will be swapped and this cmdlet takes the following parameters:
  • SourceURL - New site that you want to swap with your old site. The source site must be an existing classic team site (STS#0), Modern Team Site (STS#3) or Communication Site (SITEPAGEPUBLISHING#0)
  • TargetURL - This is your existing Classic site in the Office 365 tenant
  • ArchiveURL- Location to archive existing site. Must not currently exist (even in Recycle bin). This allows you to roll back your changes if required.
The Invoke-SPOSiteSwap cmdlet doesn't convert your existing classic site collection into a modern site collection. Instead, it just replaces the current site collection by another existing site collection! Also, any static link must be fixed manually.
change root site in sharepoint online
SharePoint Online: How to Replace Classic Root Site Collection with a Modern Site? SharePoint Online: How to Replace Classic Root Site Collection with a Modern Site? Reviewed by Salaudeen Rajack on August 30, 2019 Rating: 5

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.