We all know that, SharePoint sites design and structure are define once and far all at at a specific time; meaning it is quite difficult to change later on the structure of sites.
Well, good news, SharePoint Online is now allowing you to swap sites (aka site collections); the ‘original’ site will be archived.
To do such thing you need to use SharePoint Online PowerShell version 16.0.8812.1200 (at the time of writing the latest version is 16.0.9119.1200) – available at https://www.microsoft.com/en-us/download/details.aspx?id=35588
Then you can use the Invoke-SPOSiteSwap to request site swap.
There are few things you need to take care first:
- source and target sites can not be associated with a Hub site. You can remove the association, perform the swap and then re enable the association
- If the target site is the root site (aka https://<your tenant>.sharepoint.com), featured links will not be displayed after the swap. You will have to recreate them after
- If the target site is the root site (aka https://<your tenant>.sharepoint.com) then the template site used must be either Team Site (STS#0), Modern Team Site (STS#3) or Communication Site (SITEPAGEPUBLISHING#0)
At first, organizations with less than 50 licenses will be targeted for the update, then up to 1000 licenses. Bigger organization will have to wait a little bit more, and specific communication.
The rollout is scheduled to be started by August 2019 with an expected completion date in October 2019.
Swap sites
To swap sites, you need to use the below command after logging on to your SharePoint tenant
Connect-SPOService -Url https://<your tenant>-admin.sharepoint.com
Invoke-SPOSiteSwap –SourceUrl <URL of the new site> –TargetUrl <URL of the site to be swapped> –ArchiveUrl <URL where the original site will be archived>
Thanks for your article, Benoit,
I’ve just tried this approach on 3 of my Old tenants and it worked perfectly. This script I used:
# Replace only the RootSiteURL. Script will take care of the rest:
$RootSiteUrl = “https://TENANT.sharepoint.com”
$TenantAdminUrl = $RootSiteUrl.Replace(“.sharepoint.com”,”-admin.sharepoint.com”)
Connect-PnPOnline -Url $RootSiteUrl
$web = Get-PnPWeb
$siteUrl = New-PnPSite -Type CommunicationSite -Title $web.Title -Url “$($RootSiteUrl)/sites/newRoot”
# Need to use SharePoint Online PowerShell version 16.0.8812.1200 or later. Download Link: https://www.microsoft.com/en-us/download/details.aspx?id=35588
Connect-SPOService -Url $TenantAdminUrl
Invoke-SPOSiteSwap –SourceUrl “$($RootSiteUrl)/sites/newRoot” –TargetUrl $RootSiteUrl –ArchiveUrl “$($RootSiteUrl)/sites/oldRootArchive”