Skip to content

spo list view set

Updates existing list view

Usage

m365 spo list view set [options]

Options

-u, --webUrl <webUrl>
URL of the site where the list is located
--listId [listId]
ID of the list where the view is located. Specify either listId, listTitle, or listUrl.
--listTitle [listTitle]
Title of the list where the view is located. Specify either listId, listTitle, or listUrl.
--listUrl [listUrl]
Server- or site-relative URL of the list. Specify either listId , listTitle or listUrl.
--id [id]
ID of the view to update. Specify title or id but not both
--title [title]
Title of the view to update. Specify title or id but not both
-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 is full.
--query [query]
JMESPath query string. See http://jmespath.org/ for more information and examples
-o, --output [output]
Output type. json,text,csv,md. Default json
--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 list formatting, the value of the CustomFormatter property must be XML-escaped, eg. &lt; instead of <.

Escaping JSON in PowerShell

When updating list view formatting for a view 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 list view specified by its name

m365 spo list view set --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'My List' --title 'All items' --Title 'All events'

Update the title of the list view specified by its ID

m365 spo list view set --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl '/sites/project-x/lists/Events' --id 330f29c5-5c4c-465f-9f4b-7903020ae1ce --Title 'All events'

Update view formatting of the specified list view

m365 spo list view set --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'My List' --viewTitle 'All items' --CustomFormatter '{\"schema\":\"https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json\",\"additionalRowClass\": \"=if([$DueDate] &lt;= @now, ''sp-field-severity--severeWarning'', '''')\"}'
m365 spo list view set --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'My List' --viewTitle 'All items' --CustomFormatter "{\"schema\":\"https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json\",\"additionalRowClass\": \"=if([$DueDate] &lt;= @now, 'sp-field-severity--severeWarning', '')\"}"

Response

The command won't return a response on success.