I'm currently looking for a sneaky solution to move documents between SIte Collections. I already found a quite good looking PnP Powershell:
Connect-PnPOnline -Url https://intranet.customer.com/websites/SITECOLL1
Get-PnPList
Get-PnPFeature -Scope Site
$allDocs = (Get-PnPListItem -List Checklisten).FieldValues
$targetLib = "https://intranet.customer.com/sites/SITECOLL2/Checklisten"
foreach ($item in $allDocs){
Move-PnPFile -ServerRelativeUrl $item.FileRef -TargetUrl ($targetLib + $item.FileLeafRef) -Force
}
But unfortunately I get for every document an error message like this:
Move-PnPFile : SiteId mismatch In C:\Temp\Powershell\2019\MoveDocuments.ps1:9 Zeichen:5 + Move-PnPFile -ServerRelativeUrl $item.FileRef -TargetUrl ($target ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Move-PnPFile], ServerException + FullyQualifiedErrorId EXCEPTION,SharePointPnP.PowerShell.Commands.Files.MoveFile
We migrated from SharePoint 2013 via detach/attach to SharePoint 2019. Now it's time to switch over to modern UI without those expensive migration tools.
Any thougths/ideas out there what I'm missing or maybe another way to achieve the goal?