0

I'm trying to use the command below to copy local files to SharePoint.

Copy-PnPFolder -LocalPath "C:\Projects\BS\Banner.zip" -TargetUrl "https://Demo.sharepoint.com/sites/Demo/Documents" -Overwrite -Recurse 

But getting error:

Copy-PnPFile : A parameter cannot be found that matches parameter name 'LocalPath'.
At line:1 char:16
+ Copy-PnPFolder -LocalPath 

I'm using the following PNP.Powersehll version 1.11.0 PnP.PowerShell

Powershell Version 5.1.22621.3672

Does these versions support the parameter?

1 Answer 1

0

Ability to upload files and folders from the local folder to SharePoint online using PnP PowerShell is recently added to PnP PowerShell module.

It is not available in PnP PowerShell version 1.11.0. It is currently available in Nightly release version.

So, try these steps once:

  1. Uninstall all previously installed PnP PowerShell versions using:
Uninstall-Module PnP.PowerShell -AllVersions
  1. Install current Nightly build of PnP PowerShell using:
Install-Module PnP.PowerShell -Scope CurrentUser -AllowPrerelease -SkipPublisherCheck
  1. Try running Copy-PnPFolder command again. Example:
Copy-PnPFolder -LocalPath "c:\temp" -TargetUrl "Subsite1/Shared Documents" -Recurse -Overwrite

References:

  1. Installing PnP PowerShell
  2. Copy-PnPFolder
4
  • Thanks and will give that a shot
    – naijacoder
    Commented Jun 28 at 8:53
  • Sure, let me know how it goes. Commented Jun 28 at 9:10
  • THanks Ganesh. Is this suppose towork with Powershell Version 5.1.22621.3672. Or i need to upgrade to PS version 7?
    – naijacoder
    Commented Jul 1 at 2:58
  • You need PowerShell v7.2 or later to use PnP PowerShell. Commented Jul 1 at 3:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.