Skip to content

spo field set

Updates existing list or site column

Usage

spo field set [options]

Options

Option Description
--help output usage information
-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 listTitle or listId but not both
--listTitle [listTitle] Title of the list where the field is located (if list column). Specify listTitle or listId but not both
-i|--id [id] ID of the field to update. Specify name or id but not both
-n|--name [name] Title or internal name of the field to update. Specify name or id but not both
--updateExistingLists Set, to push the update to existing lists. Otherwise, the changes will apply to new lists only
-o, --output [output] Output type. json|text. Default text
--verbose Runs command with verbose logging
--debug Runs command with debug logging

Important

Before using this command, log in to a SharePoint Online site, using the spo login command.

Remarks

To update a list or a site column, you have to first log in to a SharePoint Online site using the spo login command, eg. spo login https://contoso.sharepoint.com.

Specify properties to update using their names, eg. --Title 'New Title' --JSLink jslink.js.

Examples

Update the title of the site column specified by its internal name and push changes to existing lists

spo field set --webUrl https://contoso.sharepoint.com/sites/project-x --name 'MyColumn' --updateExistingLists --Title 'My column'

Update the title of the list column specified by its ID

spo field set --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'My List' --id 330f29c5-5c4c-465f-9f4b-7903020ae1ce --Title 'My column'

Update column formatting of the specified list column

spo field set --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'My List' --name 'MyColumn' --CustomFormatter '`{"schema":"https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField"}`'