I have a site with various columns defined, then the site has sub-sites each with several document libraries. I am attempting to add the columns from the top level site to the sub-site libraries, but it is coming back with an error:

PS C:\tmp> set-pnpview -web $web -list "04-test" -Identity "All Documents" -Fields "Type","Name","Modified","Modified By","Received_x0020_Date"
set-pnpview : Column 'Received_x0020_Date' does not exist. It may have been deleted by another user.
At line:1 char:1
+ set-pnpview -web $web -list "04-test" -Identity "All Documents" -Fiel ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Set-PnPView], ServerException
    + FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Fields.SetView

The column in this sample is named "Received Date", and i have already worked out that its internal name is Received_x0020_Date due to the space in the middle. If i add it by hand on the settings page for the library, i can then add/remove it from the view through the same command without issue. I think i'm missing the command to actually add it as a column to the library itself. Is there another command needed? or am i going about this the wrong way?

1 Answer 1


Yes, you will need to add the field first - either directly to the list or by defining and distributing a custom content type.

To add the field directly to the list, you would use this:

Add-PnPField -List "04-test" -InternalName "ReceivedDate" -DisplayName "Received Date" -Type DateTime

Notice that the field is specified using both an internal- and display name. This way, you can change your statement in your Set-PnPView command to drop the ugly _x0020_ that SharePoint use internally when representing spaces in field names.

  • Thanks, guess i'll just have to add them first. Is there any relationship between the columns defined on the parent site and when you add them to the child? or is that there merely for convenience? My assumption was that i had to tie it to the existing column.
    – localhost
    Commented May 15, 2020 at 22:23
  • 1
    Yes, there are relationships between columns - that you can control. I really recommend reading blog series i linked (it has links to other articles) - it goes through everything you need to know about columns and content types! Commented May 16, 2020 at 7:27

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.