Skip to main content

spo contenttype field set

Adds or updates a site column reference in a site content type

Usage​

m365 spo contenttype field set [options]

Options​

-u, --webUrl <webUrl>

Absolute URL of the site where the content type is located.

--contentTypeId <contentTypeId>

ID of the content type on which the field reference should be set.

-i, --id <id>

ID of the field to which the reference should be set.

-r, --required [required]

Set to true, if the field should be required or to false if it should be optional.

--hidden [hidden]

Set to true, if the field should be hidden or to false if it should be visible.

-h, --help [help]

Output usage information. Optionally, specify which section of command's help you want to see. Allowed values are options, examples, remarks, permissions, response, full. Default is options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks​

If the field reference already exists, the command will update its required and hidden properties as specified in the command.

Examples​

Add the specified site column to the specified content type as an optional and visible field.

m365 spo contenttype field set --webUrl https://contoso.sharepoint.com/sites/portal --contentTypeId 0x01007926A45D687BA842B947286090B8F67D --id ebe7e498-44ff-43da-a7e5-99b444f656a5

Add the specified site column to the specified content type as a required field.

m365 spo contenttype field set --webUrl https://contoso.sharepoint.com/sites/portal --contentTypeId 0x01007926A45D687BA842B947286090B8F67D --id ebe7e498-44ff-43da-a7e5-99b444f656a5 --required true

Update the existing site column reference in the specified content type to optional.

m365 spo contenttype field set --webUrl https://contoso.sharepoint.com/sites/portal --contentTypeId 0x01007926A45D687BA842B947286090B8F67D --id ebe7e498-44ff-43da-a7e5-99b444f656a5 --required false

Response​

The command won't return a response on success.