Code to Batch Copy Sharepoint Libraries in Powershell and Sharegate

Import-Module Sharegate
$csvFile = "C:\Scripts\Sharepoint.csv"
$table = Import-Csv $csvFile -Delimiter ","

#$mappingSettings = New-MappingSettings


$srcsiteConnection = Connect-Site -Url https://xxxxx-admin.sharepoint.com/ -Browser
$dstsiteConnection = Connect-Site -Url https://xxxxx-admin.sharepoint.com/ -Browser


Set-Variable srcSite, dstSite, srcList, dstList
foreach ($row in $table) {
 Clear-Variable srcSite
 Clear-Variable dstSite

 $srcSite = Connect-Site -Url $row.SourceSite  -UseCredentialsFrom $srcsiteConnection
 $dstSite = Connect-Site -Url $row.DestinationSite  -UseCredentialsFrom $dstsiteConnection
 #https://documentation.sharegate.com/hc/en-us/articles/360027986731-Copy-options-in-PowerShell
 #https://documentation.sharegate.com/hc/en-us/articles/115000640448-Copy-Content
 $copysettings = New-CopySettings -OnContentItemExists IncrementalUpdate
 Copy-Site -Site $srcSite -DestinationSite $dstSite -CopySettings $copysettings

}


1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...