Skip to main content

spo tenant commandset add

Add a ListView Command Set as a tenant-wide extension

Usage

m365 spo tenant commandset add [options]

Options

-t, --title <title>

The title of the ListView Command Set.

-l, --listType <listType>

The list or library type to register the ListView Command Set on. Allowed values List or Library.

-i, --clientSideComponentId <clientSideComponentId>

The Client Side Component Id (GUID) of the ListView Command Set.

-p, --clientSideComponentProperties [clientSideComponentProperties]

The Client Side Component properties of the ListView Command Set.

-w, --webTemplate [webTemplate]

Optionally add a web template (e.g. STS#3, SITEPAGEPUBLISHING#0, etc) as a filter for what kind of sites the ListView Command Set is registered on.

--location [location]

The location of the ListView Command Set. Allowed values ContextMenu, CommandBar or Both. Defaults to CommandBar.

-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 options.

--query [query]

JMESPath query string. See http://jmespath.org/ for more information and examples.

-o, --output [output]

Output type. json, text, csv, md, none. Default json.

--verbose

Runs command with verbose logging.

--debug

Runs command with debug logging.

Remarks

Running this command from the Windows Command Shell (cmd.exe) or PowerShell for Windows OS XP, 7, 8, 8.1 without bash installed might require additional formatting for command options that have JSON, XML, or JavaScript values because the command shell treats quotes differently. For example, this is how commandset user custom action can be created from the Windows cmd.exe:

m365 spo tenant commandset add --title "YourAppCustomizer" --clientSideComponentId b41916e7-e69d-467f-b37f-ff8ecf8f99f2 --clientSideComponentProperties '{\"testMessage\":\"Test message\"}'

Note, how the clientSideComponentProperties option has escaped double quotes '{\"testMessage\":\"Test message\"}' compared to execution from bash '{"testMessage":"Test message"}'.

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.

info

To use this command, you need to be a SharePoint Admin.

This command can be used for configuring a tenant-wide ListView Command Set. To configure a ListView Command Set on a specific site, view our dedicated spo commandset add command.

Examples

Adds a ListView Command Set that's deployed tenant wide to CommandBars of Lists.

m365 spo tenant commandset add --title "Some customizer" --clientSideComponentId  799883f5-7962-4384-a10a-105adaec6ffc --listType List

Adds a ListView Command Set that is configured to the context menu of communication site libraries.

m365 spo tenant commandset  add --title "Some customizer" --clientSideComponentId  799883f5-7962-4384-a10a-105adaec6ffc --webTemplate "SITEPAGEPUBLISHING#0" --listType Library --location ContextMenu

Response

{
"FileSystemObjectType": 0,
"Id": 4,
"ServerRedirectedEmbedUri": null,
"ServerRedirectedEmbedUrl": "",
"ID": 4,
"ContentTypeId": "0x00693E2C487575B448BD420C12CEAE7EFE",
"Title": "Some ListView Command Set",
"Modified": "2023-01-11T15:47:38Z",
"Created": "2023-01-11T15:47:38Z",
"AuthorId": 9,
"EditorId": 9,
"OData__UIVersionString": "1.0",
"Attachments": false,
"GUID": "14125658-a9bc-4ddf-9c75-1b5767c9a337",
"ComplianceAssetId": null,
"TenantWideExtensionComponentId": "7096cded-b83d-4eab-96f0-df477ed7c0bc",
"TenantWideExtensionComponentProperties": "{\"testMessage\":\"Test message\"}",
"TenantWideExtensionWebTemplate": null,
"TenantWideExtensionListTemplate": 101,
"TenantWideExtensionLocation": "ClientSideExtension.ListViewCommandSet.ContextMenu",
"TenantWideExtensionSequence": 0,
"TenantWideExtensionHostProperties": null,
"TenantWideExtensionDisabled": false
}
CTRL + M