Skip to content

New command: spo tenant commandset add #4680

Description

@martinlingstuyl

Usage

spo tenant commandset add

Description

Add a ListView Command Set as a tenant wide extension.

Options

Option Description
-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.

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

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

Some things to consider while building.

  • we need to insert an item in the TenantWideExtensions list for this command. We can reuse the existing listitem add command for that.
  • we need to check if an app package is available and if skipFeatureDeployment is enabled / the app is deployed to all sites, otherwise the addition to the TenantWideExtensions list will fail.
  • we need to check if the app package contains an extension that can be deployed tenant wide.
  • We would need a note in the docs saying you need to be a SharePoint admin to deploy tenant wide.

Activity

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions