I'm trying to use this PnP PowerShell command: Add-PnPFieldToContentType to assign some site columns to a specific content type. I've connected to the site collection using this command:

Connect-PnPOnline –Url $siteUrl –Credentials ($credential)

and other PnP commands are working just fine, but Add-PnPFieldToContentType throws me this error:

Add-PnPFieldToContentType : Field or property "ShowInDisplayForm" does not exist.
At line:1 char:1
+ Add-PnPFieldToContentType -Field "SPSNumber" -ContentType "East Asia  ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Add-PnPFieldToContentType], ServerException
    + FullyQualifiedErrorId : EXCEPTION,PnP.PowerShell.Commands.ContentTypes.AddFieldToContentType

Where "SPSNumber" is the internal name of the column and "East Asia Contact" is the content type name. Here is the command I'm using:

Add-PnPFieldToContentType -Field "SPSWorkFlowName" -ContentType "example content type"

I think I have studied every article on the internet about Add-PnPFieldToContentType and none of them are doing any good.

I appreciate any idea.

  • 1
    Can you please add the command you are using in your question? where & how are you passing ShowInDisplayForm. which version of PnP PowerShell you are using? Commented Feb 21, 2021 at 12:43
  • I'm not using ShowInDisplayForm anywhere in the commands. I'm using SharePointPnPPowerShellOnline 3.29. I also added the command in the question.
    – KDM
    Commented Feb 21, 2021 at 12:56

2 Answers 2


I've tested below, and it worked for me. Add-PnPFieldToContentType uses Internal column/field name as described here. You might try changing SPSWorkFlowName to internal name SPSNumber and try again.

Import-Module -Name SharePointPnPPowerShellOnline -Verbose

#Config Variables
$SiteURL = "https://tenant.sharepoint.com/sites/yourSite/"
$ContentTypeName = "TestDocCT"
$SiteColumnName = "WorkflowName" #Internal Name
#Get Credentials to connect
$Cred = Get-Credential
Try {
    #Connect to PNP Online
    Connect-PnPOnline -Url $SiteURL -Credentials $Cred
    #Add Field to Content type
    Add-PnPFieldToContentType -Field $SiteColumnName -ContentType $ContentTypeName
catch {
    write-host "Error: $($_.Exception.Message)" -foregroundcolor Red

  • I'm using internal names for columns and still get the same error, which is: Add-PnPFieldToContentType : Field or property "ShowInDisplayForm" does not exist.
    – KDM
    Commented Feb 22, 2021 at 8:21

I figured out a way around using Sharepoint Management Shell commands like this (I'm using Windows PowerShell ISE):

#Get Web Object
$web = Get-SPWeb "site url here"
#Get Content Type
$ContentType = $web.ContentTypes["content type name"]

#Get The Field
$FieldToAdd=$web.Fields["site column name"]
#Add Field to Content type
$FieldLink = New-Object Microsoft.SharePoint.SPFieldLink($FieldToAdd)
  • this is the longest way to add field in content type. PnP is the shorter way. Unfortunately, the same happening to my script now. Unable to add field to content type. While, if I run the same line in command prompt. It works, but not working the same in function case Commented Nov 11, 2021 at 5:29

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.