Open
Description
Reporting an Issue or Missing Feature
I am encountering an error when using the Copy-PnPFile
cmdlet in PnP PowerShell. The error message indicates an "Unknown Error" with the code -1, Microsoft.SharePoint.Client.UnknownError
.
Expected behavior
When executing the Copy-PnPFile
cmdlet, I expect the specified file to be successfully copied from the source location to the destination location within SharePoint.
Actual behavior
Instead of the file being copied, I receive the following error message:
{"odata.error":{"code":"-1, Microsoft.SharePoint.Client.UnknownError","message":{"lang":"en-US","value":"Unknown Error"}}}
Steps to reproduce behavior
- Connect to the source SharePoint site using
Connect-PnPOnline
. - Make sure folder creation is enabled for the target library
Set-PnPList -Identity Documents -EnableFolderCreation:$true
- Connect to the target SharePoint site using
Connect-PnPOnline
. - Execute the
Copy-PnPFile
cmdlet with the appropriate source and destination URLs.Example script:
Connect-PnPOnline -Url "https://your-sharepoint-site-url" -Credentials (Get-Credential)
Copy-PnPFile -SourceUrl "/sites/source-site/Documents/TestFolder" -TargetUrl "/sites/destination-site/Documents"
What is the version of the Cmdlet module you are running?
To retrieve the version of the PnP PowerShell module, execute the following command:
PnP.PowerShell 2.99.128
Which operating system/environment are you running PnP PowerShell on?
- Windows
- Linux
- MacOS
- Azure Cloud Shell
- Azure Functions
- Other : please specify