Different Ways To Create A Multi-Line Text Column In SharePoint Using PnP PowerShell

PnP PowerShell provides a lot of commands to make tasks easier against SharePoint Objects. And, some of the commands (like Add-PnPField & Add-PnPFieldXml) are used to add different types of columns to SharePoint.
 
In this blog, I have provided different examples for creating Multi-Line Text Columns as Site Column, Column in a List, and Column in a Content Type using PnP PowerShell command.

Before running the add-PnPField commands, we have to connect the SharePoint site using Connect-PnPOnline command.
  1. $cred = Get-Credential  
  2. Connect-PnPOnline -Url https://<tenant>.sharepoint.com -Credential $cred  
Add Multiline Text Column to List

The following command adds the multiline text column "Remarks" to the Test List.
  1. Add-PnPField -DisplayName 'Remarks' -InternalName 'Remarks' -Type Note -List 'Test List'  
Add Multiline Text Column to Web

The following command is used to add the multiLine text column "Remarks" as a Site Column to the web.
  1. Add-PnPField -DisplayName 'Remarks' -InternalName 'Remarks' -Type Note   
Add Multiline Text Column to ContentType

The following command adds the "Remarks" column as a site column and then it's added to the Site ContentType.
  1. $field = Add-PnPField -DisplayName 'Remarks' -InternalName 'Remarks' -Type Note  
  2. Add-PnPFieldToContentType -Field $field -ContentType 'Content Type Name'  
Add Multiline Text Column to Web using Xml

The following command adds the multi line text column "Remarks" as a site column based on the XML.
  1. $guid = New-Guid  
  2. $xml = '<Field Type="Note" Name="Remarks" DisplayName="Remarks" ID="{'+$guid.Guid+'}" Group="PnP Columns" AllowDeletion="TRUE" />'  
  3. Add-PnPFieldFromXml -FieldXml $xml  
Add Multiline Text Column to List using Xml

The following command adds the multiline text column "Remarks" to the Test List based on the XML.
  1. $guid = New-Guid  
  2. $xml = '<Field Type="Note" Name="Remarks" DisplayName="Remarks" ID="{'+$guid.Guid+'}" Group="PnP Columns" AllowDeletion="TRUE" />'  
  3. Add-PnPFieldFromXml -FieldXml $xml -List 'Test List'  
Add Multiline Text Column to ContentType using Xml

The following command adds the multiline text column "Remarks" as a site column based on the XML. And then, adds that field to the content type.
  1. $guid = New-Guid  
  2. $xml = '<Field Type="Note" Name="Remarks" DisplayName="Remarks" ID="{'+$guid.Guid+'}" Group="PnP Columns" AllowDeletion="TRUE" />'  
  3. Add-PnPFieldFromXml -FieldXml $xml  
  4. Add-PnPFieldToContentType -Field $field -ContentType 'Content Type Name'  
Add Multiline Text Column as a Required Column

The following command adds the field "Remarks" as a required column to the Test List.
  1. Add-PnPField -DisplayName 'Remarks' -InternalName 'Remarks' -Type Note -List 'Test List' -Required $true