spo contenttype add
Adds a new list or site content type
Usage
m365 spo contenttype add [options]
Options
-u, --webUrl <webUrl>Absolute URL of the site where the content type should be created
-l, --listTitle [listTitle]Title of the list (if it is a list content type). Specify either
listTitle,listIdorlistUrl.--listId [listId]ID of the list (if it is a list content type). Specify either
listTitle,listIdorlistUrl.--listUrl [listUrl]Server- or site-relative URL of the list (if it is a list content type). Specify either
listTitle,listIdorlistUrl.-i, --id <id>The ID of the content type. Determines the parent content type
-n, --name <name>The name of the content type
-d, --description [description]The description of the content type
-g, --group [group]The group with which the content type should be associated
-h, --help [help]Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are
options,examples,remarks,response,full. Default isfull.--query [query]JMESPath query string. See http://jmespath.org/ for more information and examples.
-o, --output [output]Output type.
json,text,csv,md. Defaultjson.--verboseRuns command with verbose logging.
--debugRuns command with debug logging.
Remarks
If the specified content type already exists, you will get a A duplicate content type "Your Content Type" was found. error.
The ID of the content type specifies the parent content type from which this content type inherits.
Examples
Create a site content type that inherits from the List item content type
m365 spo contenttype add --webUrl https://contoso.sharepoint.com/sites/contoso-sales --name 'PnP Alert' --id 0x01007926A45D687BA842B947286090B8F67D --group 'PnP Content Types'
Create a list (retrieved by Title) content type that inherits from the List item content type
m365 spo contenttype add --webUrl https://contoso.sharepoint.com/sites/contoso-sales --listTitle Alerts --name 'PnP Alert' --id 0x01007926A45D687BA842B947286090B8F67D
Create a list (retrieved by ID) content type that inherits from the List item content type
m365 spo contenttype add --webUrl https://contoso.sharepoint.com/sites/contoso-sales --listId '8c7a0fcd-9d64-4634-85ea-ce2b37b2ec0c' --name 'PnP Alert' --id 0x01007926A45D687BA842B947286090B8F67D
Create a list (retrieved by URL) content type that inherits from the List item content type
m365 spo contenttype add --webUrl https://contoso.sharepoint.com/sites/contoso-sales --listUrl '/Shared Documents' --name 'PnP Alert' --id 0x01007926A45D687BA842B947286090B8F67D