Skip to content

[BUG] Copy-PnPFile - Microsoft.SharePoint.Client.UnknownError #4731

Open
@YuriySamorodov

Description

@YuriySamorodov

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"}}}

Image

Steps to reproduce behavior

  1. Connect to the source SharePoint site using Connect-PnPOnline.
  2. Make sure folder creation is enabled for the target library
Set-PnPList -Identity Documents -EnableFolderCreation:$true
  1. Connect to the target SharePoint site using Connect-PnPOnline.
  2. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions