I'm trying to copy files from SharePoint libraries and their metadata over to my local drive or to another hard drive eventually. I've finally managed to get the PowerShell PnP module to connect to our SharePoint (2010). I can view the ListItems per folder using

Get-PnPListItem -List "Test"

However, I'm unable to get the Get-PnPFile to work, (file name has a space in it).

Get-PnPFile -Url "\Test\1234 5678.pdf"

Gives me this error:

Get-PnPFile : Field or property "Length" does not exist. At line:1 char:1 + Get-PnPFile -Url \Test\1234 5678.pdf... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : WriteError: (:) [Get-PnPFile], ServerException + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Files.GetFile

I've tried this on different folders and different files and still get the same error. I'm wondering if its the relative URL path I'm providing that is the issue. If I take the original URL: http://domain:port/test/1234 5678.pdf it's able to pop up the pdf in the browser. My assumption is the relative URL would be "/test/1234 5678.pdf".

I'm sure I'm missing something, please advise.

  • 1
    If it fails on other files as well (that have no spaces) then spaces aren't the problem. I think your relative path is more likely the issue here. Why do you need to provide a relative path instead of the full path? Commented Dec 11, 2018 at 21:55
  • To add what Cornelius example, I think the path is the problem. If you run Get-Help Get-pnpFile -Examples, you will see that the examples how you should format the path to the file. Commented Dec 12, 2018 at 8:49
  • @CorneliusJ.vanDyk I'm just following the example of their page docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/…
    – Yodavish
    Commented Dec 12, 2018 at 13:31

1 Answer 1


I am not sure if PowerShell PnP is even compatible with SharePoint 2010. Although I would not be too surprised if some commandlets worked.

Have you tried replacing spaces with %20?

I have tried both of these examples against SP Online and they worked (sorry it's not SP2010):

Get-PnPFile -Url "Shared%20Documents/FILE%20WITH%20SPACE.txt"
Get-PnPFile -Url "Shared Documents/FILE WITH SPACE.txt"

Overall, I would say PowerShell PnP is not supposed to work with SP 2010.

  • This was the general consensus that I reached as well. Odd that it was able to use Connect-PnPOnline and use some other PnP commands though. I tried the %20 as well and sadly it didn't work.
    – Yodavish
    Commented Dec 12, 2018 at 13:28

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.