Error
Recently, I was working on a migration task. I needed to migrate a few files from the dev site to production. As this was not full migration, we were not going to use any 3rd party tool like Sharegate. So, we decided to use PowerShell to achieve our goal. Luckily, we found the "Copy-PNPFile" command in PNP PowerShell.
But when we use this to migrate, we found the below error:
Copy-PnPFile: {"odata.error":{"code":"-2147213249, Microsoft.SharePoint.Deployment.SPMigrationQosException", "message":{"lang": "en-US", "value": "Failed to verify the existence of destination location at
Solution
The solution to this problem was simple. Make sure you didn’t add “/” at the end of the target. Once I removed this, the error resolved itself.
Changing the below code from
$TargetFolderURL = "/sites/Department2/Shared%20Documents/"
To this
$TargetFolderURL = "/sites/Department2/Shared%20Documents"
And running the script again solved the problem.
Resources