Skip to content

New command: spo commandset add #4337

Description

@martinlingstuyl

Usage

spo commandset add [options]

Description

Add a ListView Command Set to a site.

Options

Option Description
-t, --title <title> The title of the ListView Command Set
-u, --webUrl <webUrl> The site to add the ListView Command Set.
-l, --listType <listType> The list or library type to register the Command Set on. Allowed values List or Library.
-i, --clientSideComponentId <clientSideComponentId> The Client Side Component Id (GUID) of the ListView Command Set.
--clientSideComponentProperties [clientSideComponentProperties] The Client Side Component properties of the ListView Command Set.
-s, --scope [scope] Scope of the ListView Command Set. Allowed values: Site, Web. Defaults to Site.
--location [location] The location of the ListView Command Set. Allowed values ContextMenu, CommandBar or Both. Defaults to CommandBar.

Examples

Adds a ListView Command Set to lists on the sales site.

m365 spo commandset  add --title "Some customizer" --clientSideComponentId  799883f5-7962-4384-a10a-105adaec6ffc --listType List --webUrl https://contoso.sharepoint.com/sites/sales

Adds a ListView Command Set to lists on the sales site with some properties.

m365 spo commandset add --title "Some customizer" --clientSideComponentId  799883f5-7962-4384-a10a-105adaec6ffc --clientSideComponentProperties '{ "someProperty": "Some value" }' --listType List --webUrl https://contoso.sharepoint.com/sites/sales

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

The location value maps to 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions