Commands › SharePoint Online

Invoke-SPOSiteSwap

SharePoint Online Microsoft.Online.SharePoint.PowerShell Invoke-*

Invokes a job to swap the location of a site with another site while archiving the original site.

Quick start script

# Invoke-SPOSiteSwap — quick start (serv365.ai)
# 1. Connect (app-only shown; interactive: omit the certificate parameters)
Connect-SPOService -Url https://$org-admin.sharepoint.com

# 2. Run and inspect
Invoke-SPOSiteSwap -ArchiveUrl <String> -SourceUrl <String> | Format-List

# 3. Export for evidence / drift tracking
Invoke-SPOSiteSwap | Export-Clixml .\SPOSiteSwap-$(Get-Date -Format yyyyMMdd).xml

Syntax

Invoke-SPOSiteSwap [-SourceUrl] <String> [[-TargetUrl] <String>] [-ArchiveUrl] <String> [-DisableRedirection]
 [-Force] [-NoWait] [<CommonParameters>]

Parameters (6)

ParameterTypeRequiredWhat it controls
-ArchiveUrl String yes URL that the target site will be archived to. There should be no existing site, including a deleted site in the Recycle Bin, at this location before performing the swap.
-DisableRedirection Switch Parameter Disables the site redirect from being created at the Source URL location.
-Force SwitchParameter Overrides and ignores any warnings that have been identified by the Page Diagnostic Tool that are preventing a swap from being initiated.
-NoWait SwitchParameter This parameter is reserved for internal Microsoft use.
-SourceUrl String yes URL of the source site. The site at this location must exist before performing the swap.
-TargetUrl String URL of the target site that the source site will be swapped to. The site at this location must exist before performing the swap.

Reference facts derived from Microsoft documentation, © Microsoft, licensed CC BY 4.0; restructured with original guidance by serv365.ai.