Skip to content

ConvertTo-MigrationTargetedPackage

SharePoint Online: Creates a targeted migration package

#Requires -Version 5.1
#Requires -Modules Microsoft.Online.SharePoint.PowerShell

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$TargetWebUrl,
    [Parameter(Mandatory = $true)]
    [string]$SourceFilesPath,
    [Parameter(Mandatory = $true)]
    [string]$SourcePackagePath,
    [Parameter(Mandatory = $true)]
    [string]$TargetFilesPath,
    [Parameter(Mandatory = $true)]
    [string]$TargetPackagePath,
    [pscredential]$Credential
)

Process {
    try {
        $cmdArgs = @{ ErrorAction = 'Stop'; TargetWebUrl = $TargetWebUrl; SourceFilesPath = $SourceFilesPath; SourcePackagePath = $SourcePackagePath; TargetFilesPath = $TargetFilesPath; TargetPackagePath = $TargetPackagePath }
        if ($null -ne $Credential) { $cmdArgs.Add('Credentials', $Credential) }
        $result = ConvertTo-SPOMigrationTargetedPackage @cmdArgs | Select-Object *
        if ($null -ne $result) { $result | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force }
    }
    catch { throw }
}

Target SharePoint web URL

Temporary path with XML source files

Source package path

Path for target output

Target package output path

Optional target credentials

An interactive directory of PowerShell scripts.