SharePoint Online SPOMod: New-SPOListContentTypeColumn
This article describes a function of a custom SharePoint Online module available for download and installation on GitHub.
New-SPOListContentTypeColumn
Adds an existing column to a list content type.
Parameters
ListTitle | Mandatory | String. Name of the title where the content type is located. |
ColumnName | Mandatory | String. Internal name of a title of the column. Please beware! Display name is most often NOT the title nor internal name. |
ContentTypeID | Mandatory | String. The ID of the content type. |
ListColumn | Optional | Switch. Whether the column to be added is a list column or a site column. |
Examples
----- EXAMPLE 1 ------
Add a column to the Content Type.
New-SPOListContentTypeColumn -ListTitle MyList6 -ColumnName Author -ContentTypeID 0x010722
----- EXAMPLE 2 ------
Add all list columns to one list Content Type.
$FieldInternalNames=(Get-SPOListFields -ListTitle "MyList6").InternalName
foreach( $inti in $FieldInternalNames){New-SPOListContentTypeColumn -ListTitle "MyList6" -ColumnName $inti -ContentTypeID 0x0100E36FF6B362D1B34BB955946F1523F73D}
foreach( $inti in $FieldInternalNames){New-SPOListContentTypeColumn -ListTitle "MyList6" -ColumnName $inti -ContentTypeID 0x0100E36FF6B362D1B34BB955946F1523F73D -ListColumn}
See Also
SPOMod Cmdlets and Resources
New-SPOSiteContentType
New-SPOListContentType
New-SPOSiteContentTypeColumn
Wiki: SharePoint Online content types in Powershell: Add
Wiki: SharePoint Online content types in Powershell: Get
Wiki: SharePoint Online content types in Powershell: Edit