spo field set
Updates existing list or site column
Usage
m365 spo field set [options]
Options
-u, --webUrl <webUrl>
Absolute URL of the site where the field is located.
--listId [listId]
ID of the list where the field is located (if list column). Specify either
listTitle
,listId
orlistUrl
.--listTitle [listTitle]
Title of the list where the field is located (if list column). Specify either
listTitle
,listId
orlistUrl
.--listUrl [listUrl]
Server- or site-relative URL of the list where the field is located (if list column). Specify either
listTitle
,listId
orlistUrl
.-i, --id [id]
ID of the field to update. Specify either
id
ortitle
but not both.-t, --title [title]
Title or internal name of the field to update. Specify either
id
ortitle
but not both.--updateExistingLists
Set, to push the update to existing lists. Otherwise, the changes will apply to new lists only.
-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 isoptions
.--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples.
-o, --output [output]
Output type.
json
,text
,csv
,md
,none
. Defaultjson
.--verbose
Runs command with verbose logging.
--debug
Runs command with debug logging.
Remarks
Specify properties to update using their names, eg. --Title 'New Title' --JSLink jslink.js
.
When updating column formatting for a field with the --CustomFormatter
option, it's possible to enter a JSON string. In PowerShell 5 to 7.2 specific escaping rules apply due to an issue. Remember that you can also use file tokens instead.
Examples
Update the title of the site column specified by its internal name and push changes to existing lists.
m365 spo field set --webUrl https://contoso.sharepoint.com/sites/project-x --title 'MyColumn' --updateExistingLists --Title 'My column'
Update the title of the list column specified by its ID.
m365 spo field set --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'My List' --id 330f29c5-5c4c-465f-9f4b-7903020ae1ce --Title 'My column'
Update the description of a column specified by the ID on a list retrieved by the URL.
m365 spo field set --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl '/sites/project-x/Lists/My List' --id 330f29c5-5c4c-465f-9f4b-7903020ae1ce --Description 'My column Description'
Update column formatting of the specified list column.
m365 spo field set --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'My List' --title 'MyColumn' --CustomFormatter '{"schema":"https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField"}'
Response
The command won't return a response on success.