Usage
spo commandset set [options]
Description
Updates a ListView Command Set on a site.
Options
| Option |
Description |
-u, --webUrl <webUrl> |
The site to update the ListView Command Set on. |
-t, --title [title] |
The title of the ListView Command Set to update. Specify either title, id or clientSideComponentId. |
-i, --id [id] |
The id of the ListView Command Set to update. Specify either title, id or clientSideComponentId. |
-c, --clientSideComponentId [clientSideComponentId] |
The Client Side Component Id (GUID) of the ListView Command Set to update. Specify either title, id or clientSideComponentId. |
--newTitle [newTitle] |
The new title of the ListView Command Set. |
-l, --listType [listType] |
The list or library type to register the Command Set on. Allowed values List or Library. |
--clientSideComponentProperties [clientSideComponentProperties] |
The Client Side Component properties of the ListView Command Set. |
-s, --scope [scope] |
The scope where to lookup the ListView Command Set: at site level or web level. Allowed values: Site, Web, All. Defaults to All. |
--location [location] |
The location of the ListView Command Set. Allowed values ContextMenu, CommandBar or Both. |
Examples
Updates the title and location of a ListView Command Set on the sales site.
m365 spo commandset set --clientSideComponentId 799883f5-7962-4384-a10a-105adaec6ffc --newTitle "Some new title" --location Both --webUrl https://contoso.sharepoint.com/sites/sales --scope Site
Updates a ListView Command Set on the sales site with some properties.
m365 spo commandset set --title "Some customizer" --clientSideComponentProperties '{ "someProperty": "Some value" }' --webUrl https://contoso.sharepoint.com/sites/sales --scope Site
Remarks
Add the following notice (like on https://pnp.github.io/cli-microsoft365/cmd/spo/customaction/customaction-add/)
Escaping JSON in PowerShell When using the --clientSideComponentProperties 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.
Additional Info
While developing we want to reuse the getCustomActions and getCustomActionById functions of the spo util class.
- If the found custom action is not an command set: throw an error.
- If two or more command set custom actions are found: prompt the user to disambiguate.
We can use the shared code to only query the commandset customaction we want: with a location value of ClientSideExtension.ListViewCommandSet, ClientSideExtension.ListViewCommandSet.CommandBar or ClientSideExtension.ListViewCommandSet.ContextMenu based on the value that's used.
The listType value maps to --registrationId of the custom action. List maps to 100, Library maps to 101
Usage
spo commandset set [options]
Description
Updates a ListView Command Set on a site.
Options
-u, --webUrl <webUrl>-t, --title [title]title,idorclientSideComponentId.-i, --id [id]title,idorclientSideComponentId.-c, --clientSideComponentId [clientSideComponentId]title,idorclientSideComponentId.--newTitle [newTitle]-l, --listType [listType]ListorLibrary.--clientSideComponentProperties [clientSideComponentProperties]-s, --scope [scope]Site,Web,All. Defaults toAll.--location [location]ContextMenu,CommandBarorBoth.Examples
Updates the title and location of a ListView Command Set on the sales site.
Updates a ListView Command Set on the sales site with some properties.
Remarks
Add the following notice (like on https://pnp.github.io/cli-microsoft365/cmd/spo/customaction/customaction-add/)
Additional Info
While developing we want to reuse the
getCustomActionsandgetCustomActionByIdfunctions of the spo util class.We can use the shared code to only query the commandset customaction we want: with a location value of
ClientSideExtension.ListViewCommandSet,ClientSideExtension.ListViewCommandSet.CommandBarorClientSideExtension.ListViewCommandSet.ContextMenubased on the value that's used.The
listTypevalue maps to--registrationIdof the custom action.Listmaps to100,Librarymaps to101