Microsoft's recently announced a new PowerShell capability for SharePoint Online users that gets executed using the Invoke-SPOSiteSwap command-let. Site Swap swaps out an organisation's SharePoint Online root site. It might get used by organisations making the shift to so-called "modern" SharePoint Online pages, for instance. It'll archive the older swapped pages as part of the process.
Modern pages are based on using the SharePoint Framework. It involves a developer switch to client-side application development using lightweight Web developer tools, in contrast to the old .NET server-side app development approach. Modern pages also follow a more flattened intranet structure, with the relatively new Hub Sites page located at the top of the organisational hierarchy.
In that regard, there's a particular restriction on using Site Swap. Before executing a swap, "the source or target sites cannot be 'associated' with an Office 365 group or be connected to a SharePoint hub site," Microsoft's announcement warned. Those dependencies have to be remove first before running the command-let.
Microsoft explained that Site Swap allows SharePoint administrators to swap the location a SharePoint root site with another site via a PowerShell command. Microsoft creates a root site collection for SharePoint Online users (who are known as "tenants"). The root site is the entry point for the SharePoint Online tenant. However, it's been found that customers have sometimes "followed unrecommended guidance on deleting the root site," and then later wondered what went wrong. Site Swap is designed ease such matters.
Some restrictions exist. The source or target sites can’t be associated with an Office 365 Group (team) or a hub site. The target site can only be the root site or the search centre. There’s several other notes to read up on in the documentation. Basically, this is a focused command-let that does what it says: Invokes a job to swap the location of a site with another site while archiving the original site.
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)
Safety and support
"The Site Swap provides a safe and supported mechanism for replacing the root site with another site," Microsoft explained.
It's possible that Office 365 tenants might not see Site Swap feature yet because Microsoft has been releasing it to tenants with about 1,000 seats first before broadening the release. That's a nontraditional release approach, but Microsoft adopted it to gauge how Site Swap might work across high-volume sites, Microsoft explained.