SharePoint Point Online migration PowerShell is cmdlets is another ways of content migration without using the tool.
Below is the step by step SharePoint Online PowerShell cmdlets to migrate the content. It requires minimal CSOM (Client object model) call to avoid the threshold. It leverages temporary Azure Blob Storage container to hold the content and Azure Queue, which schedule parallel jobs.
Prerequisites to use the SPO Migration API
Here are the steps for using SPO Migration PowerShell to upload your on-premises data into SharePoint Online
Step1:- Export your document library content
This cmdlets export on-premises content to define folder structure.
Parameter
ItemUrl: - relative path of document library or list (i.e. /sites/teamsite/contentlib )
Path: - folder structure path (C:\MigrationAPI\Contentlib)
Example
Export-SPWeb -Identity "<<SiteUrl>>" -ItemUrl "<<document library relative path>>" -Path "<<physical folder path>>" -NoFileCompression -IncludeVersions All
Step2:- Get your credentials into variables
$username = "manoj@sharepointtimes.onmicrosoft.com"
$cred = Get-Credential $username
Step3:- Set Source Package & File Path
At initial stage source file & package is same as export path of document library
$sourceFiles = "C:\MigrationAPI\Contentlib "
$sourcePackage=" C:\MigrationAPI\Contentlib "
Step4:- Set Output Package Path
$outputPackagePath = "C:\MigrationAPI\outputPackagePath"
Step5:- Get target web & library
$targetWebUrl = "https://sharepointtimes.sharepoint.com/sites/teamsite"
$targetLibrary = "contentlib"
Step6:- Convert Package for your target site
This creates a content package from a backup folder, the New-SPOMigrationPackage command reads the list of content targeted by the source path and will generate XML to perform the migration.
The following parameters are required:-
sourceFiles: points to the content you want to migrate
sourcePackage: points to content you want to migrate
targetWebUrl: point to your destination web
targetLibrary: point to the document library inside the web.
OutputPackagePath: points to your Temporary folder
Example:-
This example show how to convert a package to a target one by looking into source
ConvertTo-SPOMigrationTargetedPackage -SourceFilesPath $sourceFiles -SourcePackagePath $sourceFiles -OutputPackagePath $outputPackagePath -TargetWebUrl $targetWebUrl -TargetDocumentLibraryPath $targetLibrary -Credentials $cred
Step7:- Set Azure Storage Path & Variable
$fileContainerName = "onlinefile01”
$packageContainerName ="onlinepackage01"
$azureAccountName = "onlineazurestorage"
$azureAccountKey = “TQDKxHnHUDCG7uCjlfk646fzH5BV+mjjrocA9p6P0ENCJ2aHoY4+F6xOfdhnUslQ=="
$azureAzureQueueName = "migrationqueue01"
Step8:- Set SharePoint Online Migration Package source
This cmdlet help to create a defined file & package container into Azure blob storage as well as move the content from source file & output package path
The following parameters are required & optional:-
source files: points to the content you want to migrate
source package: points to your Temporary folder
FileContainerName:- temporary file container to hold the content (optional)
PackageContainerName:- temporary package container to hold the package (optional)
AccountName:- Azure blob storage account name
AccountKey:- Azure blob storage account access key
AzureQueueName:- Azure storage queue name (optional)
Example
$azurelocations=Set-SPOMigrationPackageAzureSource -SourceFilesPath $sourceFiles -SourcePackagePath $outputPackagePath -FileContainerName $fileContainerName -PackageContainerName $packageContainerName -AccountName $azureAccountName -AccountKey $azureAccountKey –Overwrite -AzureQueueName $azureAzureQueueName
Step9:- List down the Azure Storage File container, Package Container & Queue URI
$azurelocations|fl
Step10:- Submit the Migration Job
This cmdlets help to generate the parallel queue to migrate the content from temporary storage to target web
There are three required parameter
TargetWebUrl:- target weburl where content need to migrate
MigrationPackageAzureLocations:- above set variable
Example
Submit-SPOMigrationJob -TargetWebUrl $targetWebUrl -MigrationPackageAzureLocations $azurelocations -Credentials $cred
Step11:- Monitoring the job status (Optional)
After the job is submitted, Only Azure Migration Queue interact to fetch and migrate the content to target SharePoint Online Site. This process is timer-job based.
Example
This cmdlet gives the running job status, If it doesn’t return any value – it means processing has been completed else it shows In Processing.
Get-SPOMigrationJobStatus -TargetWebUrl $targetWebUrl -Credentials $cred