Created
November 25, 2022 09:54
-
-
Save AlexanderHolmeset/b513f895ba54da093e6a34fb6b16ff00 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module Sharegate | |
$csvFile = "C:\temp\CopyContentOneDrive.csv" | |
$table = Import-Csv $csvFile -Delimiter "," | |
$tenantsource = Connect-Site -Url "https://contoso-admin.sharepoint.com" -Browser | |
$tenantdest = Connect-Site -Url "https://tailspin-admin.sharepoint.com" -Browser | |
$copysettings = New-CopySettings -OnContentItemExists IncrementalUpdate | |
Set-Variable srcSite, dstSite, srcList, dstList | |
foreach ($row in $table) { | |
Clear-Variable srcSite | |
Clear-Variable dstSite | |
Clear-Variable srcList | |
Clear-Variable dstList | |
$srcSite = Connect-Site -Url $row.SourceSite -UseCredentialsFrom $tenantsource | |
$dstSite = Connect-Site -Url $row.DestinationSite -UseCredentialsFrom $tenantdest | |
#The name of the folder is dependant on what language you use in your tenant. | |
#Run Get-List -Site $srcSite to see what the name of the documents foldr is | |
$srcList = Get-List -Site $srcSite -Name "Documents" | |
$dstList = Get-List -Site $dstSite -Name "Documents" | |
Copy-Content -SourceList $srcList -DestinationList $dstList -CopySettings $copysettings | |
#comment out bellow commands if you plan on running a incremental copy later. | |
Remove-SiteCollectionAdministrator -Site $srcSite | |
Remove-SiteCollectionAdministrator -Site $dstSite | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment