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, orlistUrl.--listTitle [listTitle]Title of the list where the view is located. Specify either
listId,listTitle, orlistUrl.--listUrl [listUrl]Server- or site-relative URL of the list. Specify either
listId,listTitleorlistUrl.--id [id]ID of the view to update. Specify
titleoridbut not both--title [title]Title of the view to update. Specify
titleoridbut 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,permissions,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.--verboseRuns command with verbose logging.
--debugRuns 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. < instead of <.
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.
Permissions
- Delegated
- Application
| Resource | Permissions |
|---|---|
| SharePoint | AllSites.Write |
| Resource | Permissions |
|---|---|
| SharePoint | Sites.ReadWrite.All |
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
- PowerShell
- Bash
m365 spo list view set --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'My List' --title 'All items' --CustomFormatter '{\"schema\":\"https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json\",\"additionalRowClass\": \"=if([$DueDate] <= @now, ''sp-field-severity--severeWarning'', '''')\"}'
m365 spo list view set --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'My List' --title 'All items' --CustomFormatter "{\"schema\":\"https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json\",\"additionalRowClass\": \"=if([$DueDate] <= @now, 'sp-field-severity--severeWarning', '')\"}"
Response
The command won't return a response on success.