Introduction
In this article. I have explained how to switch the existing classic site to modern SharePoint site and backup the existing site to archival site using Invoke-SPOSiteSwap
It requires SharePoint admin PowerShell version 16.0.8812.1200 or later.
This tutorial is applicable to Sharepoint online.
Command
- Invoke-SPOSiteSwap -SourceUrl <SiteUrl Parameter>
- -TargetUrl <SiteUrl Parameter>
- -ArchiveUrl <SiteUrl Parameter>
Before run the above site swap command, connect to your sharepoint tenant using the below command:
- Connect-SPOService -Url <adminUrl>
- Connect-SPOService -Url "https://sharepointtechie-admin.sharepoint.com"
Provide the username and password for your tenant to connect.
My root site collection is a classic site template. But I want the existing communication site to be replaced as a root site collection.
Root Site Collection Classic Template #STS0
I have a communication site that's already created.
Communication Site Template
Now run the PowerShell cmdlet to swap the existing communication site with a classic template.
SourceURL
The site template can be whatever you want, whether it be Modern/Classic/Communication/Search, it can be replaced with the target site collection
TargetUrl
The site you want to replace the template
ArchiveUrl
It moves the existing site collection to archival.
Note
ArchiveUrl does not contain the already existing SharePoint site collection and site collection from the recycle bin. You need to provide a unique site collection for ArchiveUrl.
It creates the site collection URL provided and moves content into it from the target site collection.
Finally...
Hit the Archived Site URL. It has been replaced successfully.
Happy Coding