From 34b170ddb3049e29da417c4f83ba48b52db17b82 Mon Sep 17 00:00:00 2001
From: Milan Holemans <11723921+milanholemans@users.noreply.github.com>
Date: Wed, 15 May 2024 01:34:38 +0200
Subject: [PATCH] Adds 'componentProperties' option to 'spo spfx' commands.
Closes #5975
---
.../applicationcustomizer-get.mdx | 121 +++++++++++------
.../applicationcustomizer-list.mdx | 42 +++---
.../cmd/spo/commandset/commandset-get.mdx | 99 ++++++++++----
.../cmd/spo/commandset/commandset-list.mdx | 58 ++++-----
.../tenant-applicationcustomizer-get.mdx | 109 +++++++++++-----
.../tenant-applicationcustomizer-list.mdx | 39 +++---
.../cmd/spo/tenant/tenant-commandset-get.mdx | 122 ++++++++++++------
.../cmd/spo/tenant/tenant-commandset-list.mdx | 39 +++---
.../applicationcustomizer-get.spec.ts | 34 ++++-
.../applicationcustomizer-get.ts | 43 +++---
.../commandset/commandset-get.spec.ts | 47 ++++++-
.../spo/commands/commandset/commandset-get.ts | 51 +++++---
.../tenant-applicationcustomizer-get.spec.ts | 30 ++++-
.../tenant-applicationcustomizer-get.ts | 27 +++-
.../tenant/tenant-commandset-get.spec.ts | 85 ++++--------
.../commands/tenant/tenant-commandset-get.ts | 29 ++++-
src/utils/formatting.ts | 18 +++
17 files changed, 648 insertions(+), 345 deletions(-)
diff --git a/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx b/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx
index 26720f68d48..c71852ffe9c 100644
--- a/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx
+++ b/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-get.mdx
@@ -29,6 +29,9 @@ m365 spo applicationcustomizer get [options]
`-s, --scope [scope]`
: Scope of the application customizer. Allowed values: `Site`, `Web`, `All`. Defaults to `All`.
+
+`-p, --clientSideComponentProperties`
+: Only output the client-side component properties.
```
@@ -59,36 +62,45 @@ Retrieves an application customizer by title available at the site scope.
m365 spo applicationcustomizer get --title "Some customizer" --webUrl https://contoso.sharepoint.com/sites/sales --scope site
```
+Retrieves the client-side component properties of a application customizer.
+
+```sh
+m365 spo applicationcustomizer get --id 14125658-a9bc-4ddf-9c75-1b5767c9a337 --webUrl https://contoso.sharepoint.com/sites/sales --clientSideComponentProperties
+```
+
## Remarks
This command can be used for retrieving an application customizer from a specific site. To retrieve an application customizer that's installed tenant-wide, view our dedicated [spo tenant applicationcustomizer get](../tenant/tenant-applicationcustomizer-get.mdx) command.
## Response
+### Standard response
+
```json
{
- "ClientSideComponentId": "7096cded-b83d-4eab-96f0-df477ed7c0bc",
- "ClientSideComponentProperties": "",
+ "ClientSideComponentId": "9a8b100c-246b-4592-9454-67826523e159",
+ "ClientSideComponentProperties": "{\"testMessage\":\"Test message\"}",
"CommandUIExtension": null,
"Description": null,
"Group": null,
- "Id": "14125658-a9bc-4ddf-9c75-1b5767c9a337",
+ "HostProperties": "",
+ "Id": "4a428b32-08cf-45c7-9986-17585af38806",
"ImageUrl": null,
"Location": "ClientSideExtension.ApplicationCustomizer",
- "Name": "Some customizer",
+ "Name": "{4a428b32-08cf-45c7-9986-17585af38806}",
"RegistrationId": null,
"RegistrationType": 0,
- "Rights": "{\"High\":0,\"Low\":0}",
+ "Rights": "{\"High\":\"0\",\"Low\":\"0\"}",
"Scope": "Web",
"ScriptBlock": null,
"ScriptSrc": null,
- "Sequence": 0,
- "Title": "Some customizer",
+ "Sequence": 65536,
+ "Title": "HelloWorld",
"Url": null,
- "VersionOfUserCustomAction": "16.0.1.0"
+ "VersionOfUserCustomAction": "1.0.1.0"
}
```
@@ -96,65 +108,102 @@ This command can be used for retrieving an application customizer from a specifi
```text
- ClientSideComponentId : 7096cded-b83d-4eab-96f0-df477ed7c0bc
- ClientSideComponentProperties:
+ ClientSideComponentId : 9a8b100c-246b-4592-9454-67826523e159
+ ClientSideComponentProperties: {"testMessage":"Test message"}
CommandUIExtension : null
Description : null
Group : null
- Id : 14125658-a9bc-4ddf-9c75-1b5767c9a337
+ HostProperties :
+ Id : 4a428b32-08cf-45c7-9986-17585af38806
ImageUrl : null
Location : ClientSideExtension.ApplicationCustomizer
- Name : Some customizer
+ Name : {4a428b32-08cf-45c7-9986-17585af38806}
RegistrationId : null
RegistrationType : 0
- Rights : {"High":0,"Low":0}
+ Rights : {"High":"0","Low":"0"}
Scope : Web
ScriptBlock : null
ScriptSrc : null
- Sequence : 0
- Title : Some customizer
+ Sequence : 65536
+ Title : HelloWorld
Url : null
- VersionOfUserCustomAction : 16.0.1.0
+ VersionOfUserCustomAction : 1.0.1.0
```
```csv
- ClientSideComponentId,ClientSideComponentProperties,CommandUIExtension,Description,Group,Id,ImageUrl,Location,Name,RegistrationId,RegistrationType,Rights,Scope,ScriptBlock,ScriptSrc,Sequence,Title,Url,VersionOfUserCustomAction
- 7096cded-b83d-4eab-96f0-df477ed7c0bc,,,,,14125658-a9bc-4ddf-9c75-1b5767c9a337,,ClientSideExtension.ApplicationCustomizer,Some customizer,,0,"{""High"":0,""Low"":0}",Web,,,0,Some customizer,,16.0.1.0
+ ClientSideComponentId,ClientSideComponentProperties,CommandUIExtension,Description,Group,HostProperties,Id,ImageUrl,Location,Name,RegistrationId,RegistrationType,Rights,Scope,ScriptBlock,ScriptSrc,Sequence,Title,Url,VersionOfUserCustomAction
+ 9a8b100c-246b-4592-9454-67826523e159,"{""testMessage"":""Test message""}",,,,,4a428b32-08cf-45c7-9986-17585af38806,,ClientSideExtension.ApplicationCustomizer,{4a428b32-08cf-45c7-9986-17585af38806},,0,"{""High"":""0"",""Low"":""0""}",Web,,,65536,HelloWorld,,1.0.1.0
```
```md
- # spo applicationcustomizer get --title "Some customizer" --webUrl "https://contoso.sharepoint.com/sites/sales" --scope "Web"
+ # spo applicationcustomizer get --webUrl "https://contoso.sharepoint.com/sites/Marketing" --id "4a428b32-08cf-45c7-9986-17585af38806"
- Date: 3/6/2023
+ Date: 16/05/2024
- ## Some customizer (14125658-a9bc-4ddf-9c75-1b5767c9a337)
+ ## HelloWorld (4a428b32-08cf-45c7-9986-17585af38806)
Property | Value
---------|-------
- ClientSideComponentId | 7096cded-b83d-4eab-96f0-df477ed7c0bc
- ClientSideComponentProperties |
- CommandUIExtension | null
- Description | null
- Group | null
- Id | 14125658-a9bc-4ddf-9c75-1b5767c9a337
- ImageUrl | null
+ ClientSideComponentId | 9a8b100c-246b-4592-9454-67826523e159
+ ClientSideComponentProperties | {"testMessage":"Test message"}
+ HostProperties |
+ Id | 4a428b32-08cf-45c7-9986-17585af38806
Location | ClientSideExtension.ApplicationCustomizer
- Name | Some customizer
- RegistrationId | null
+ Name | {4a428b32-08cf-45c7-9986-17585af38806}
RegistrationType | 0
+ Rights | {"High":"0","Low":"0"}
Scope | Web
- ScriptBlock | null
- ScriptSrc | null
- Sequence | 0
- Title | Some customizer
- Url | null
- VersionOfUserCustomAction | 16.0.1.0
+ Sequence | 65536
+ Title | HelloWorld
+ VersionOfUserCustomAction | 1.0.1.0
+ ```
+
+
+
+
+### `clientSideComponentProperties` response
+
+
+
+
+ ```json
+ {
+ "testMessage": "Test message"
+ }
+ ```
+
+
+
+
+ ```txt
+ testMessage: Test message
+ ```
+
+
+
+
+ ```csv
+ testMessage
+ Test message
+ ```
+
+
+
+
+ ```md
+ # spo applicationcustomizer get --title "Some customizer" --webUrl "https://contoso.sharepoint.com/sites/sales" --scope "Web" --clientSideComponentProperties "true"
+
+ Date: 15/05/2024
+
+ Property | Value
+ ---------|-------
+ testMessage | Test message
```
diff --git a/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx b/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx
index 4d2e3668e41..bcfe78ea623 100644
--- a/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx
+++ b/docs/docs/cmd/spo/applicationcustomizer/applicationcustomizer-list.mdx
@@ -44,16 +44,16 @@ This command can be used for retrieving a list of application customizers from a
```json
[
{
- "ClientSideComponentId": "4358e70e-ec3c-4713-beb6-39c88f7621d1",
- "ClientSideComponentProperties": "{\"listTitle\":\"News\",\"listViewTitle\":\"Published News\"}",
+ "ClientSideComponentId": "9a8b100c-246b-4592-9454-67826523e159",
+ "ClientSideComponentProperties": "{\"testMessage\":\"Test message\"}",
"CommandUIExtension": null,
"Description": null,
"Group": null,
"HostProperties": "",
- "Id": "f405303c-6048-4636-9660-1b7b2cadaef9",
+ "Id": "4a428b32-08cf-45c7-9986-17585af38806",
"ImageUrl": null,
"Location": "ClientSideExtension.ApplicationCustomizer",
- "Name": "{f405303c-6048-4636-9660-1b7b2cadaef9}",
+ "Name": "{4a428b32-08cf-45c7-9986-17585af38806}",
"RegistrationId": null,
"RegistrationType": 0,
"Rights": {
@@ -64,7 +64,7 @@ This command can be used for retrieving a list of application customizers from a
"ScriptBlock": null,
"ScriptSrc": null,
"Sequence": 65536,
- "Title": "NewsTicker",
+ "Title": "HelloWorld",
"Url": null,
"VersionOfUserCustomAction": "1.0.1.0"
}
@@ -75,47 +75,41 @@ This command can be used for retrieving a list of application customizers from a
```text
- Name Location Scope Id
- -------------------------------------- ----------------------------------------- ----- ------------------------------------
- {f405303c-6048-4636-9660-1b7b2cadaef9} ClientSideExtension.ApplicationCustomizer 3 f405303c-6048-4636-9660-1b7b2cadaef9
+ Id Location Name Scope
+ ------------------------------------ ----------------------------------------- -------------------------------------- -----
+ 4a428b32-08cf-45c7-9986-17585af38806 ClientSideExtension.ApplicationCustomizer {4a428b32-08cf-45c7-9986-17585af38806} 3
```
```csv
- Name,Location,Scope,Id
- {f405303c-6048-4636-9660-1b7b2cadaef9},ClientSideExtension.ApplicationCustomizer,3,f405303c-6048-4636-9660-1b7b2cadaef9
+ ClientSideComponentId,ClientSideComponentProperties,CommandUIExtension,Description,Group,HostProperties,Id,ImageUrl,Location,Name,RegistrationId,RegistrationType,Scope,ScriptBlock,ScriptSrc,Sequence,Title,Url,VersionOfUserCustomAction
+ 9a8b100c-246b-4592-9454-67826523e159,"{""testMessage"":""Test message""}",,,,,4a428b32-08cf-45c7-9986-17585af38806,,ClientSideExtension.ApplicationCustomizer,{4a428b32-08cf-45c7-9986-17585af38806},,0,3,,,65536,HelloWorld,,1.0.1.0
```
```md
- # spo applicationcustomizer list --webUrl "https://contoso.sharepoint.com"
+ # spo applicationcustomizer list --webUrl "https://contoso.sharepoint.com/sites/Marketing"
- Date: 28/2/2023
+ Date: 16/05/2024
- ## NewsTicker (f405303c-6048-4636-9660-1b7b2cadaef9)
+ ## HelloWorld (4a428b32-08cf-45c7-9986-17585af38806)
Property | Value
---------|-------
- ClientSideComponentId | 4358e70e-ec3c-4713-beb6-39c88f7621d1
- CommandUIExtension | null
- Description | null
- Group | null
+ ClientSideComponentId | 9a8b100c-246b-4592-9454-67826523e159
+ ClientSideComponentProperties | {"testMessage":"Test message"}
HostProperties |
- Id | f405303c-6048-4636-9660-1b7b2cadaef9
- ImageUrl | null
+ Id | 4a428b32-08cf-45c7-9986-17585af38806
Location | ClientSideExtension.ApplicationCustomizer
- RegistrationId | null
+ Name | {4a428b32-08cf-45c7-9986-17585af38806}
RegistrationType | 0
Scope | 3
- ScriptBlock | null
- ScriptSrc | null
Sequence | 65536
- Title | NewsTicker
- Url | null
+ Title | HelloWorld
VersionOfUserCustomAction | 1.0.1.0
```
diff --git a/docs/docs/cmd/spo/commandset/commandset-get.mdx b/docs/docs/cmd/spo/commandset/commandset-get.mdx
index 39f311da027..2968c0eb72f 100644
--- a/docs/docs/cmd/spo/commandset/commandset-get.mdx
+++ b/docs/docs/cmd/spo/commandset/commandset-get.mdx
@@ -29,6 +29,9 @@ m365 spo commandset get [options]
`-s, --scope [scope]`
: Scope of the ListView Command Set. Allowed values: `Site`, `Web`, `All`. Defaults to `All`.
+
+`-p, --clientSideComponentProperties`
+: Only output the client-side component properties.
```
@@ -50,7 +53,7 @@ m365 spo commandset get --title "Some customizer" --webUrl https://contoso.share
Retrieves a ListView Command Set by id with scope 'Web'.
```sh
-m365 spo commandset get --id 14125658-a9bc-4ddf-9c75-1b5767c9a337 --webUrl https://contoso.sharepoint.com/sites/sales -scope Web
+m365 spo commandset get --id 14125658-a9bc-4ddf-9c75-1b5767c9a337 --webUrl https://contoso.sharepoint.com/sites/sales --scope Web
```
Retrieves a ListView Command Set by clientSideComponentId with scope 'Site'.
@@ -59,23 +62,31 @@ Retrieves a ListView Command Set by clientSideComponentId with scope 'Site'.
m365 spo commandset get --clientSideComponentId c1cbd896-5140-428d-8b0c-4873be19f5ac --webUrl https://contoso.sharepoint.com/sites/sales --scope Site
```
+Retrieves the client-side component properties of a ListView Command Set.
+
+```sh
+m365 spo commandset get --id 14125658-a9bc-4ddf-9c75-1b5767c9a337 --webUrl https://contoso.sharepoint.com/sites/sales --clientSideComponentProperties
+```
+
## Response
+### Standard response
+
```json
{
- "ClientSideComponentId": "c1cbd896-5140-428d-8b0c-4873be19f5ac",
+ "ClientSideComponentId": "53dd6a38-1461-44e0-9bf0-14883316a316",
"ClientSideComponentProperties": "{\"sampleTextOne\":\"One item is selected in the list.\", \"sampleTextTwo\":\"This command is always visible.\"}",
"CommandUIExtension": null,
"Description": null,
"Group": null,
"HostProperties": "",
- "Id": "9a0674de-2f3d-4a26-ba79-62b460ddd327",
+ "Id": "bb26547d-c9b7-4ed1-b793-00cbe53388d6",
"ImageUrl": null,
"Location": "ClientSideExtension.ListViewCommandSet.CommandBar",
- "Name": "{9a0674de-2f3d-4a26-ba79-62b460ddd327}",
+ "Name": "{bb26547d-c9b7-4ed1-b793-00cbe53388d6}",
"RegistrationId": "100",
"RegistrationType": 1,
"Rights": {
@@ -86,7 +97,7 @@ m365 spo commandset get --clientSideComponentId c1cbd896-5140-428d-8b0c-4873be19
"ScriptBlock": null,
"ScriptSrc": null,
"Sequence": 65536,
- "Title": "Notification",
+ "Title": "HelloWorld",
"Url": null,
"VersionOfUserCustomAction": "1.0.1.0"
}
@@ -96,16 +107,16 @@ m365 spo commandset get --clientSideComponentId c1cbd896-5140-428d-8b0c-4873be19
```text
- ClientSideComponentId : c1cbd896-5140-428d-8b0c-4873be19f5ac
+ ClientSideComponentId : 53dd6a38-1461-44e0-9bf0-14883316a316
ClientSideComponentProperties: {"sampleTextOne":"One item is selected in the list.", "sampleTextTwo":"This command is always visible."}
CommandUIExtension : null
Description : null
Group : null
HostProperties :
- Id : 9a0674de-2f3d-4a26-ba79-62b460ddd327
+ Id : bb26547d-c9b7-4ed1-b793-00cbe53388d6
ImageUrl : null
Location : ClientSideExtension.ListViewCommandSet.CommandBar
- Name : {9a0674de-2f3d-4a26-ba79-62b460ddd327}
+ Name : {bb26547d-c9b7-4ed1-b793-00cbe53388d6}
RegistrationId : 100
RegistrationType : 1
Rights : {"High":"0","Low":"0"}
@@ -113,7 +124,7 @@ m365 spo commandset get --clientSideComponentId c1cbd896-5140-428d-8b0c-4873be19
ScriptBlock : null
ScriptSrc : null
Sequence : 65536
- Title : Notification
+ Title : HelloWorld
Url : null
VersionOfUserCustomAction : 1.0.1.0
```
@@ -122,40 +133,80 @@ m365 spo commandset get --clientSideComponentId c1cbd896-5140-428d-8b0c-4873be19
```csv
- ClientSideComponentId,ClientSideComponentProperties,CommandUIExtension,Description,Group,HostProperties,Id,ImageUrl,Location,Name,RegistrationId,RegistrationType,Rights,Scope,ScriptBlock,ScriptSrc,Sequence,Title,Url,VersionOfUserCustomAction
- c1cbd896-5140-428d-8b0c-4873be19f5ac,"{""sampleTextOne"":""One item is selected in the list."", ""sampleTextTwo"":""This command is always visible.""}",,,,,9a0674de-2f3d-4a26-ba79-62b460ddd327,,ClientSideExtension.ListViewCommandSet.CommandBar,{9a0674de-2f3d-4a26-ba79-62b460ddd327},100,1,"{""High"":""0"",""Low"":""0""}",3,,,65536,Notification,,1.0.1.0
+ ClientSideComponentId,ClientSideComponentProperties,CommandUIExtension,Description,Group,HostProperties,Id,ImageUrl,Location,Name,RegistrationId,RegistrationType,Scope,ScriptBlock,ScriptSrc,Sequence,Title,Url,VersionOfUserCustomAction
+ 53dd6a38-1461-44e0-9bf0-14883316a316,"{""sampleTextOne"":""One item is selected in the list."", ""sampleTextTwo"":""This command is always visible.""}",,,,,bb26547d-c9b7-4ed1-b793-00cbe53388d6,,ClientSideExtension.ListViewCommandSet.CommandBar,{bb26547d-c9b7-4ed1-b793-00cbe53388d6},100,1,3,,,65536,HelloWorld,,1.0.1.0
```
```md
- # spo commandset get --webUrl "https://contoso.sharepoint.com/sites/sales" --id "9a0674de-2f3d-4a26-ba79-62b460ddd327"
+ # spo commandset get --webUrl "https://contoso.sharepoint.com/sites/sales" --id "bb26547d-c9b7-4ed1-b793-00cbe53388d6"
- Date: 27/02/2023
+ Date: 16/05/2024
- ## Notification (9a0674de-2f3d-4a26-ba79-62b460ddd327)
+ ## HelloWorld (bb26547d-c9b7-4ed1-b793-00cbe53388d6)
Property | Value
---------|-------
- ClientSideComponentId | c1cbd896-5140-428d-8b0c-4873be19f5ac
- CommandUIExtension | null
- Description | null
- Group | null
+ ClientSideComponentId | 53dd6a38-1461-44e0-9bf0-14883316a316
+ ClientSideComponentProperties | {"sampleTextOne":"One item is selected in the list.", "sampleTextTwo":"This command is always visible."}
HostProperties |
- Id | 9a0674de-2f3d-4a26-ba79-62b460ddd327
- ImageUrl | null
+ Id | bb26547d-c9b7-4ed1-b793-00cbe53388d6
Location | ClientSideExtension.ListViewCommandSet.CommandBar
+ Name | {bb26547d-c9b7-4ed1-b793-00cbe53388d6}
RegistrationId | 100
RegistrationType | 1
Scope | 3
- ScriptBlock | null
- ScriptSrc | null
Sequence | 65536
- Title | Notification
- Url | null
+ Title | HelloWorld
VersionOfUserCustomAction | 1.0.1.0
```
+
+### `clientSideComponentProperties` response
+
+
+
+
+ ```json
+ {
+ "sampleTextOne": "One item is selected in the list.",
+ "sampleTextTwo": "This command is always visible."
+ }
+ ```
+
+
+
+
+ ```txt
+ sampleTextOne: One item is selected in the list.
+ sampleTextTwo: This command is always visible.
+ ```
+
+
+
+
+ ```csv
+ sampleTextOne,sampleTextTwo
+ One item is selected in the list.,This command is always visible.
+ ```
+
+
+
+
+ ```md
+ # spo commandset get --webUrl "https://contoso.sharepoint.com/sites/sales" --id "9a0674de-2f3d-4a26-ba79-62b460ddd327" --clientSideComponentProperties "true"
+
+ Date: 15/05/2024
+
+ Property | Value
+ ---------|-------
+ sampleTextOne | One item is selected in the list.
+ sampleTextTwo | This command is always visible.
+ ```
+
+
+
diff --git a/docs/docs/cmd/spo/commandset/commandset-list.mdx b/docs/docs/cmd/spo/commandset/commandset-list.mdx
index dbb17be461b..bbb428e040f 100644
--- a/docs/docs/cmd/spo/commandset/commandset-list.mdx
+++ b/docs/docs/cmd/spo/commandset/commandset-list.mdx
@@ -44,29 +44,29 @@ m365 spo commandset list --webUrl https://contoso.sharepoint.com/sites/sales
```json
[
{
- "ClientSideComponentId": "b206e130-1a5b-4ae7-86a7-4f91c9924d0a",
- "ClientSideComponentProperties": "",
+ "ClientSideComponentId": "53dd6a38-1461-44e0-9bf0-14883316a316",
+ "ClientSideComponentProperties": "{\"sampleTextOne\":\"One item is selected in the list.\", \"sampleTextTwo\":\"This command is always visible.\"}",
"CommandUIExtension": null,
"Description": null,
"Group": null,
"HostProperties": "",
- "Id": "e7000aef-f756-4997-9420-01cc84f9ac9c",
+ "Id": "bb26547d-c9b7-4ed1-b793-00cbe53388d6",
"ImageUrl": null,
"Location": "ClientSideExtension.ListViewCommandSet.CommandBar",
- "Name": "{e7000aef-f756-4997-9420-01cc84f9ac9c}",
+ "Name": "{bb26547d-c9b7-4ed1-b793-00cbe53388d6}",
"RegistrationId": "100",
- "RegistrationType": 0,
+ "RegistrationType": 1,
"Rights": {
"High": 0,
"Low": 0
},
- "Scope": 2,
+ "Scope": 3,
"ScriptBlock": null,
"ScriptSrc": null,
- "Sequence": 0,
- "Title": "test",
+ "Sequence": 65536,
+ "Title": "HelloWorld",
"Url": null,
- "VersionOfUserCustomAction": "16.0.1.0"
+ "VersionOfUserCustomAction": "1.0.1.0"
}
]
```
@@ -75,49 +75,43 @@ m365 spo commandset list --webUrl https://contoso.sharepoint.com/sites/sales
```text
- Name Location Scope Id
- -------------------------------------- ------------------------------------------------- ----- ------------------------------------
- {e7000aef-f756-4997-9420-01cc84f9ac9c} ClientSideExtension.ListViewCommandSet.CommandBar 2 e7000aef-f756-4997-9420-01cc84f9ac9c
+ Id Location Name Scope
+ ------------------------------------ ------------------------------------------------- -------------------------------------- -----
+ bb26547d-c9b7-4ed1-b793-00cbe53388d6 ClientSideExtension.ListViewCommandSet.CommandBar {bb26547d-c9b7-4ed1-b793-00cbe53388d6} 3
```
```csv
- Name,Location,Scope,Id
- {e7000aef-f756-4997-9420-01cc84f9ac9c},ClientSideExtension.ListViewCommandSet.CommandBar,2,e7000aef-f756-4997-9420-01cc84f9ac9c
+ ClientSideComponentId,ClientSideComponentProperties,CommandUIExtension,Description,Group,HostProperties,Id,ImageUrl,Location,Name,RegistrationId,RegistrationType,Scope,ScriptBlock,ScriptSrc,Sequence,Title,Url,VersionOfUserCustomAction
+ 53dd6a38-1461-44e0-9bf0-14883316a316,"{""sampleTextOne"":""One item is selected in the list."", ""sampleTextTwo"":""This command is always visible.""}",,,,,bb26547d-c9b7-4ed1-b793-00cbe53388d6,,ClientSideExtension.ListViewCommandSet.CommandBar,{bb26547d-c9b7-4ed1-b793-00cbe53388d6},100,1,3,,,65536,HelloWorld,,1.0.1.0
```
```md
- # spo commandset list --webUrl "https://ordidev.sharepoint.com"
+ # spo commandset list --webUrl "https://contoso.sharepoint.com/sites/Marketing"
- Date: 20/2/2023
+ Date: 16/05/2024
- ## test (e7000aef-f756-4997-9420-01cc84f9ac9c)
+ ## HelloWorld (bb26547d-c9b7-4ed1-b793-00cbe53388d6)
Property | Value
---------|-------
- ClientSideComponentId | b206e130-1a5b-4ae7-86a7-4f91c9924d0a
- ClientSideComponentProperties |
- CommandUIExtension | null
- Description | null
- Group | null
+ ClientSideComponentId | 53dd6a38-1461-44e0-9bf0-14883316a316
+ ClientSideComponentProperties | {"sampleTextOne":"One item is selected in the list.", "sampleTextTwo":"This command is always visible."}
HostProperties |
- Id | e7000aef-f756-4997-9420-01cc84f9ac9c
- ImageUrl | null
+ Id | bb26547d-c9b7-4ed1-b793-00cbe53388d6
Location | ClientSideExtension.ListViewCommandSet.CommandBar
+ Name | {bb26547d-c9b7-4ed1-b793-00cbe53388d6}
RegistrationId | 100
- RegistrationType | 0
- Scope | 2
- ScriptBlock | null
- ScriptSrc | null
- Sequence | 0
- Title | test
- Url | null
- VersionOfUserCustomAction | 16.0.1.0
+ RegistrationType | 1
+ Scope | 3
+ Sequence | 65536
+ Title | HelloWorld
+ VersionOfUserCustomAction | 1.0.1.0
```
diff --git a/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.mdx b/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.mdx
index 630b34bc0d0..5652bf085a0 100644
--- a/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.mdx
+++ b/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-get.mdx
@@ -23,6 +23,9 @@ m365 spo tenant applicationcustomizer get [options]
`-c, --clientSideComponentId [clientSideComponentId]`
: The Client Side Component Id (GUID) of the application customizer. Specify either `title`, `id`, or `clientSideComponentId`.
+
+`-p, --tenantWideExtensionComponentProperties`
+: Only output the tenant wide extension component properties.
```
@@ -53,26 +56,29 @@ This command can be used for retrieving an application customizer that's install
## Response
+### Standard response
+
```json
{
"FileSystemObjectType": 0,
- "Id": 4,
+ "Id": 2,
"ServerRedirectedEmbedUri": null,
"ServerRedirectedEmbedUrl": "",
- "ContentTypeId": "0x00693E2C487575B448BD420C12CEAE7EFE",
- "Title": "Some customizer",
- "Modified": "2023-01-11T15:47:38Z",
- "Created": "2023-01-11T15:47:38Z",
+ "ContentTypeId": "0x00DBF24546DE6018449BB43573F3581BF0",
+ "Title": "HelloWorld",
+ "Modified": "2024-05-16T21:59:09Z",
+ "Created": "2024-05-16T21:59:09Z",
"AuthorId": 9,
"EditorId": 9,
"OData__UIVersionString": "1.0",
"Attachments": false,
- "GUID": "14125658-a9bc-4ddf-9c75-1b5767c9a337",
+ "GUID": "dfc6a646-742b-4d9d-9fcf-892a972298ff",
+ "OData__ColorTag": null,
"ComplianceAssetId": null,
- "TenantWideExtensionComponentId": "7096cded-b83d-4eab-96f0-df477ed7c0bc",
+ "TenantWideExtensionComponentId": "9a8b100c-246b-4592-9454-67826523e159",
"TenantWideExtensionComponentProperties": "{\"testMessage\":\"Test message\"}",
"TenantWideExtensionWebTemplate": null,
"TenantWideExtensionListTemplate": 0,
@@ -90,17 +96,18 @@ This command can be used for retrieving an application customizer that's install
Attachments : false
AuthorId : 9
ComplianceAssetId : null
- ContentTypeId : 0x00693E2C487575B448BD420C12CEAE7EFE
- Created : 2023-01-11T15:47:38Z
+ ContentTypeId : 0x00DBF24546DE6018449BB43573F3581BF0
+ Created : 2024-05-16T21:59:09Z
EditorId : 9
FileSystemObjectType : 0
- GUID : 14125658-a9bc-4ddf-9c75-1b5767c9a337
- Id : 4
- Modified : 2023-01-11T15:47:38Z
+ GUID : dfc6a646-742b-4d9d-9fcf-892a972298ff
+ Id : 2
+ Modified : 2024-05-16T21:59:09Z
+ OData__ColorTag : null
OData__UIVersionString : 1.0
ServerRedirectedEmbedUri : null
ServerRedirectedEmbedUrl :
- TenantWideExtensionComponentId : 7096cded-b83d-4eab-96f0-df477ed7c0bc
+ TenantWideExtensionComponentId : 9a8b100c-246b-4592-9454-67826523e159
TenantWideExtensionComponentProperties: {"testMessage":"Test message"}
TenantWideExtensionDisabled : false
TenantWideExtensionHostProperties : null
@@ -108,51 +115,93 @@ This command can be used for retrieving an application customizer that's install
TenantWideExtensionLocation : ClientSideExtension.ApplicationCustomizer
TenantWideExtensionSequence : 0
TenantWideExtensionWebTemplate : null
- Title : Some customizer
+ Title : HelloWorld
```
```csv
- FileSystemObjectType,Id,ServerRedirectedEmbedUri,ServerRedirectedEmbedUrl,ContentTypeId,Title,Modified,Created,AuthorId,EditorId,OData__UIVersionString,Attachments,GUID,ComplianceAssetId,TenantWideExtensionComponentId,TenantWideExtensionComponentProperties,TenantWideExtensionWebTemplate,TenantWideExtensionListTemplate,TenantWideExtensionLocation,TenantWideExtensionSequence,TenantWideExtensionHostProperties,TenantWideExtensionDisabled
- 0,4,,,0x00693E2C487575B448BD420C12CEAE7EFE,Some customizer,2023-01-11T15:47:38Z,2023-01-11T15:47:38Z,9,9,1.0,,14125658-a9bc-4ddf-9c75-1b5767c9a337,,7096cded-b83d-4eab-96f0-df477ed7c0bc,"{""testMessage"":""Test message""}",,0,ClientSideExtension.ApplicationCustomizer,0,,
+ FileSystemObjectType,Id,ServerRedirectedEmbedUri,ServerRedirectedEmbedUrl,ContentTypeId,Title,Modified,Created,AuthorId,EditorId,OData__UIVersionString,Attachments,GUID,OData__ColorTag,ComplianceAssetId,TenantWideExtensionComponentId,TenantWideExtensionComponentProperties,TenantWideExtensionWebTemplate,TenantWideExtensionListTemplate,TenantWideExtensionLocation,TenantWideExtensionSequence,TenantWideExtensionHostProperties,TenantWideExtensionDisabled
+ 0,2,,,0x00DBF24546DE6018449BB43573F3581BF0,HelloWorld,2024-05-16T21:59:09Z,2024-05-16T21:59:09Z,9,9,1.0,,dfc6a646-742b-4d9d-9fcf-892a972298ff,,,9a8b100c-246b-4592-9454-67826523e159,"{""testMessage"":""Test message""}",,0,ClientSideExtension.ApplicationCustomizer,0,,
```
```md
- # spo tenant applicationcustomizer get --title "Some customizer"
+ # spo tenant applicationcustomizer get --id "2"
- Date: 1/13/2023
+ Date: 17/05/2024
- ## Some customizer (4)
+ ## HelloWorld (2)
Property | Value
---------|-------
FileSystemObjectType | 0
- Id | 4
- ServerRedirectedEmbedUri | null
+ Id | 2
ServerRedirectedEmbedUrl |
- ContentTypeId | 0x00693E2C487575B448BD420C12CEAE7EFE
- Title | Some customizer
- Modified | 2023-01-11T15:47:38Z
- Created | 2023-01-11T15:47:38Z
+ ContentTypeId | 0x00DBF24546DE6018449BB43573F3581BF0
+ Title | HelloWorld
+ Modified | 2024-05-16T21:59:09Z
+ Created | 2024-05-16T21:59:09Z
AuthorId | 9
EditorId | 9
OData\_\_UIVersionString | 1.0
Attachments | false
- GUID | 14125658-a9bc-4ddf-9c75-1b5767c9a337
- ComplianceAssetId | null
- TenantWideExtensionComponentId | 7096cded-b83d-4eab-96f0-df477ed7c0bc
- TenantWideExtensionWebTemplate | null
+ GUID | dfc6a646-742b-4d9d-9fcf-892a972298ff
+ TenantWideExtensionComponentId | 9a8b100c-246b-4592-9454-67826523e159
+ TenantWideExtensionComponentProperties | {"testMessage":"Test message"}
TenantWideExtensionListTemplate | 0
TenantWideExtensionLocation | ClientSideExtension.ApplicationCustomizer
TenantWideExtensionSequence | 0
- TenantWideExtensionHostProperties | null
TenantWideExtensionDisabled | false
```
+
+### `tenantWideExtensionComponentProperties` response
+
+
+
+
+ ```json
+ {
+ "sampleTextOne": "One item is selected in the list.",
+ "sampleTextTwo": "This command is always visible."
+ }
+ ```
+
+
+
+
+ ```txt
+ sampleTextOne: One item is selected in the list.
+ sampleTextTwo: This command is always visible.
+ ```
+
+
+
+
+ ```csv
+ sampleTextOne,sampleTextTwo
+ One item is selected in the list.,This command is always visible.
+ ```
+
+
+
+
+ ```md
+ # spo tenant commandset get --id "1" --tenantWideExtensionComponentProperties "true"
+
+ Date: 16/05/2024
+
+ Property | Value
+ ---------|-------
+ sampleTextOne | One item is selected in the list.
+ sampleTextTwo | This command is always visible.
+ ```
+
+
+
diff --git a/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx b/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx
index 3b090a98da5..0ef529044a8 100644
--- a/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx
+++ b/docs/docs/cmd/spo/tenant/tenant-applicationcustomizer-list.mdx
@@ -37,21 +37,21 @@ m365 spo tenant applicationcustomizer list
[
{
"FileSystemObjectType": 0,
- "Id": 8,
+ "Id": 2,
"ServerRedirectedEmbedUri": null,
"ServerRedirectedEmbedUrl": "",
- "ContentTypeId": "0x00693E2C487575B448BD420C12CEAE7EFE",
+ "ContentTypeId": "0x00DBF24546DE6018449BB43573F3581BF0",
"Title": "HelloWorld",
- "Modified": "2023-05-21T14:31:30Z",
- "Created": "2023-05-21T14:31:30Z",
+ "Modified": "2024-05-16T21:59:09Z",
+ "Created": "2024-05-16T21:59:09Z",
"AuthorId": 9,
"EditorId": 9,
"OData__UIVersionString": "1.0",
"Attachments": false,
- "GUID": "23951a41-f613-440e-8119-8f1e87df1d1a",
+ "GUID": "dfc6a646-742b-4d9d-9fcf-892a972298ff",
"OData__ColorTag": null,
"ComplianceAssetId": null,
- "TenantWideExtensionComponentId": "d54e75e7-af4d-455f-9101-a5d906692ecd",
+ "TenantWideExtensionComponentId": "9a8b100c-246b-4592-9454-67826523e159",
"TenantWideExtensionComponentProperties": "{\"testMessage\":\"Test message\"}",
"TenantWideExtensionWebTemplate": null,
"TenantWideExtensionListTemplate": 0,
@@ -67,17 +67,17 @@ m365 spo tenant applicationcustomizer list
```text
- TenantWideExtensionComponentId: d54e75e7-af4d-455f-9101-a5d906692ecd
- TenantWideExtensionWebTemplate: null
- Title : HelloWorld
+ TenantWideExtensionComponentId TenantWideExtensionWebTemplate Title
+ ------------------------------------ ------------------------------ ----------
+ 9a8b100c-246b-4592-9454-67826523e159 null HelloWorld
```
```csv
- FileSystemObjectType,Id,ServerRedirectedEmbedUrl,ContentTypeId,Title,Modified,Created,AuthorId,EditorId,OData__UIVersionString,Attachments,GUID,TenantWideExtensionComponentId,TenantWideExtensionComponentProperties,TenantWideExtensionListTemplate,TenantWideExtensionLocation,TenantWideExtensionSequence,TenantWideExtensionDisabled
- 0,8,,0x00693E2C487575B448BD420C12CEAE7EFE,HelloWorld,2023-05-21T14:31:30Z,2023-05-21T14:31:30Z,9,9,1.0,,23951a41-f613-440e-8119-8f1e87df1d1a,d54e75e7-af4d-455f-9101-a5d906692ecd,"{""testMessage"":""Test message""}",0,ClientSideExtension.ApplicationCustomizer,0,
+ FileSystemObjectType,Id,ServerRedirectedEmbedUri,ServerRedirectedEmbedUrl,ContentTypeId,Title,Modified,Created,AuthorId,EditorId,OData__UIVersionString,Attachments,GUID,OData__ColorTag,ComplianceAssetId,TenantWideExtensionComponentId,TenantWideExtensionComponentProperties,TenantWideExtensionWebTemplate,TenantWideExtensionListTemplate,TenantWideExtensionLocation,TenantWideExtensionSequence,TenantWideExtensionHostProperties,TenantWideExtensionDisabled
+ 0,2,,,0x00DBF24546DE6018449BB43573F3581BF0,HelloWorld,2024-05-16T21:59:09Z,2024-05-16T21:59:09Z,9,9,1.0,,dfc6a646-742b-4d9d-9fcf-892a972298ff,,,9a8b100c-246b-4592-9454-67826523e159,"{""testMessage"":""Test message""}",,0,ClientSideExtension.ApplicationCustomizer,0,,
```
@@ -86,25 +86,26 @@ m365 spo tenant applicationcustomizer list
```md
# spo tenant applicationcustomizer list
- Date: 5/21/2023
+ Date: 17/05/2024
- ## HelloWorld (8)
+ ## HelloWorld (2)
Property | Value
---------|-------
FileSystemObjectType | 0
- Id | 8
+ Id | 2
ServerRedirectedEmbedUrl |
- ContentTypeId | 0x00693E2C487575B448BD420C12CEAE7EFE
+ ContentTypeId | 0x00DBF24546DE6018449BB43573F3581BF0
Title | HelloWorld
- Modified | 2023-05-21T14:31:30Z
- Created | 2023-05-21T14:31:30Z
+ Modified | 2024-05-16T21:59:09Z
+ Created | 2024-05-16T21:59:09Z
AuthorId | 9
EditorId | 9
OData\_\_UIVersionString | 1.0
Attachments | false
- GUID | 23951a41-f613-440e-8119-8f1e87df1d1a
- TenantWideExtensionComponentId | d54e75e7-af4d-455f-9101-a5d906692ecd
+ GUID | dfc6a646-742b-4d9d-9fcf-892a972298ff
+ TenantWideExtensionComponentId | 9a8b100c-246b-4592-9454-67826523e159
+ TenantWideExtensionComponentProperties | {"testMessage":"Test message"}
TenantWideExtensionListTemplate | 0
TenantWideExtensionLocation | ClientSideExtension.ApplicationCustomizer
TenantWideExtensionSequence | 0
diff --git a/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx b/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx
index 112f10a1b0f..1b6c6f12b5b 100644
--- a/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx
+++ b/docs/docs/cmd/spo/tenant/tenant-commandset-get.mdx
@@ -23,6 +23,9 @@ m365 spo tenant commandset get [options]
`-c, --clientSideComponentId [clientSideComponentId]`
: The Client Side Component Id (GUID) of the ListView Command Set. Specify either `title`, `id`, or `clientSideComponentId`.
+
+`-p, --tenantWideExtensionComponentProperties`
+: Only output the tenant wide extension component properties.
```
@@ -53,30 +56,33 @@ m365 spo tenant commandset get --clientSideComponentId 7096cded-b83d-4eab-96f0-d
## Response
+### Standard response
+
```json
{
"FileSystemObjectType": 0,
- "Id": 4,
+ "Id": 1,
"ServerRedirectedEmbedUri": null,
"ServerRedirectedEmbedUrl": "",
- "ContentTypeId": "0x00693E2C487575B448BD420C12CEAE7EFE",
- "Title": "Some ListView Command Set",
- "Modified": "2023-01-11T15:47:38Z",
- "Created": "2023-01-11T15:47:38Z",
+ "ContentTypeId": "0x00DBF24546DE6018449BB43573F3581BF0",
+ "Title": "HelloWorld",
+ "Modified": "2024-05-16T21:28:51Z",
+ "Created": "2024-05-16T21:28:51Z",
"AuthorId": 9,
"EditorId": 9,
"OData__UIVersionString": "1.0",
"Attachments": false,
- "GUID": "14125658-a9bc-4ddf-9c75-1b5767c9a337",
+ "GUID": "bd123dcd-37b8-4981-aa4e-1aab50a66688",
+ "OData__ColorTag": null,
"ComplianceAssetId": null,
- "TenantWideExtensionComponentId": "7096cded-b83d-4eab-96f0-df477ed7c0bc",
- "TenantWideExtensionComponentProperties": "{\"testMessage\":\"Test message\"}",
+ "TenantWideExtensionComponentId": "53dd6a38-1461-44e0-9bf0-14883316a316",
+ "TenantWideExtensionComponentProperties": "{\"sampleTextOne\":\"One item is selected in the list.\", \"sampleTextTwo\":\"This command is always visible.\"}",
"TenantWideExtensionWebTemplate": null,
- "TenantWideExtensionListTemplate": 101,
- "TenantWideExtensionLocation": "ClientSideExtension.ListViewCommandSet.ContextMenu",
+ "TenantWideExtensionListTemplate": 100,
+ "TenantWideExtensionLocation": "ClientSideExtension.ListViewCommandSet.CommandBar",
"TenantWideExtensionSequence": 0,
"TenantWideExtensionHostProperties": null,
"TenantWideExtensionDisabled": false
@@ -90,69 +96,109 @@ m365 spo tenant commandset get --clientSideComponentId 7096cded-b83d-4eab-96f0-d
Attachments : false
AuthorId : 9
ComplianceAssetId : null
- ContentTypeId : 0x00693E2C487575B448BD420C12CEAE7EFE
- Created : 2023-01-11T15:47:38Z
+ ContentTypeId : 0x00DBF24546DE6018449BB43573F3581BF0
+ Created : 2024-05-16T21:28:51Z
EditorId : 9
FileSystemObjectType : 0
- GUID : 14125658-a9bc-4ddf-9c75-1b5767c9a337
- Id : 4
- Modified : 2023-01-11T15:47:38Z
+ GUID : bd123dcd-37b8-4981-aa4e-1aab50a66688
+ Id : 1
+ Modified : 2024-05-16T21:28:51Z
+ OData__ColorTag : null
OData__UIVersionString : 1.0
ServerRedirectedEmbedUri : null
ServerRedirectedEmbedUrl :
- TenantWideExtensionComponentId : 7096cded-b83d-4eab-96f0-df477ed7c0bc
- TenantWideExtensionComponentProperties: {"testMessage":"Test message"}
+ TenantWideExtensionComponentId : 53dd6a38-1461-44e0-9bf0-14883316a316
+ TenantWideExtensionComponentProperties: {"sampleTextOne":"One item is selected in the list.", "sampleTextTwo":"This command is always visible."}
TenantWideExtensionDisabled : false
TenantWideExtensionHostProperties : null
- TenantWideExtensionListTemplate : 101
- TenantWideExtensionLocation : ClientSideExtension.ListViewCommandSet.ContextMenu
+ TenantWideExtensionListTemplate : 100
+ TenantWideExtensionLocation : ClientSideExtension.ListViewCommandSet.CommandBar
TenantWideExtensionSequence : 0
TenantWideExtensionWebTemplate : null
- Title : Some ListView Command Set
+ Title : HelloWorld
```
```csv
- FileSystemObjectType,Id,ServerRedirectedEmbedUri,ServerRedirectedEmbedUrl,ContentTypeId,Title,Modified,Created,AuthorId,EditorId,OData__UIVersionString,Attachments,GUID,ComplianceAssetId,TenantWideExtensionComponentId,TenantWideExtensionComponentProperties,TenantWideExtensionWebTemplate,TenantWideExtensionListTemplate,TenantWideExtensionLocation,TenantWideExtensionSequence,TenantWideExtensionHostProperties,TenantWideExtensionDisabled
- 0,4,,,0x00693E2C487575B448BD420C12CEAE7EFE,Some ListView Command Set,2023-01-11T15:47:38Z,2023-01-11T15:47:38Z,9,9,1.0,,14125658-a9bc-4ddf-9c75-1b5767c9a337,,7096cded-b83d-4eab-96f0-df477ed7c0bc,"{""testMessage"":""Test message""}",,101,ClientSideExtension.ListViewCommandSet.ContextMenu,0,,
+ FileSystemObjectType,Id,ServerRedirectedEmbedUri,ServerRedirectedEmbedUrl,ContentTypeId,Title,Modified,Created,AuthorId,EditorId,OData__UIVersionString,Attachments,GUID,OData__ColorTag,ComplianceAssetId,TenantWideExtensionComponentId,TenantWideExtensionComponentProperties,TenantWideExtensionWebTemplate,TenantWideExtensionListTemplate,TenantWideExtensionLocation,TenantWideExtensionSequence,TenantWideExtensionHostProperties,TenantWideExtensionDisabled
+ 0,1,,,0x00DBF24546DE6018449BB43573F3581BF0,HelloWorld,2024-05-16T21:28:51Z,2024-05-16T21:28:51Z,9,9,1.0,,bd123dcd-37b8-4981-aa4e-1aab50a66688,,,53dd6a38-1461-44e0-9bf0-14883316a316,"{""sampleTextOne"":""One item is selected in the list."", ""sampleTextTwo"":""This command is always visible.""}",,100,ClientSideExtension.ListViewCommandSet.CommandBar,0,,
```
```md
- # spo tenant commandset get --title "Some ListView Command Set"
+ # spo tenant commandset get --id "1"
- Date: 1/13/2023
+ Date: 16/05/2024
- ## Some ListView Command Set (4)
+ ## HelloWorld (1)
Property | Value
---------|-------
FileSystemObjectType | 0
- Id | 4
- ServerRedirectedEmbedUri | null
+ Id | 1
ServerRedirectedEmbedUrl |
- ContentTypeId | 0x00693E2C487575B448BD420C12CEAE7EFE
- Title | Some customizer
- Modified | 2023-01-11T15:47:38Z
- Created | 2023-01-11T15:47:38Z
+ ContentTypeId | 0x00DBF24546DE6018449BB43573F3581BF0
+ Title | HelloWorld
+ Modified | 2024-05-16T21:28:51Z
+ Created | 2024-05-16T21:28:51Z
AuthorId | 9
EditorId | 9
OData\_\_UIVersionString | 1.0
Attachments | false
- GUID | 14125658-a9bc-4ddf-9c75-1b5767c9a337
- ComplianceAssetId | null
- TenantWideExtensionComponentId | 7096cded-b83d-4eab-96f0-df477ed7c0bc
- TenantWideExtensionWebTemplate | null
- TenantWideExtensionListTemplate | 101
- TenantWideExtensionLocation | ClientSideExtension.ListViewCommandSet.ContextMenu
+ GUID | bd123dcd-37b8-4981-aa4e-1aab50a66688
+ TenantWideExtensionComponentId | 53dd6a38-1461-44e0-9bf0-14883316a316
+ TenantWideExtensionComponentProperties | {"sampleTextOne":"One item is selected in the list.", "sampleTextTwo":"This command is always visible."}
+ TenantWideExtensionListTemplate | 100
+ TenantWideExtensionLocation | ClientSideExtension.ListViewCommandSet.CommandBar
TenantWideExtensionSequence | 0
- TenantWideExtensionHostProperties | null
TenantWideExtensionDisabled | false
```
+
+### `tenantWideExtensionComponentProperties` response
+
+
+
+
+ ```json
+ {
+ "testMessage": "Test message"
+ }
+ ```
+
+
+
+
+ ```txt
+ testMessage: Test message
+ ```
+
+
+
+
+ ```csv
+ testMessage
+ Test message
+ ```
+
+
+
+
+ ```md
+ # spo tenant applicationcustomizer get --id "2" --tenantWideExtensionComponentProperties "true"
+
+ Date: 17/05/2024
+
+ Property | Value
+ ---------|-------
+ testMessage | Test message
+ ```
+
+
+
diff --git a/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx b/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx
index 9c3d844b1ea..1cdcf7ad84e 100644
--- a/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx
+++ b/docs/docs/cmd/spo/tenant/tenant-commandset-list.mdx
@@ -37,21 +37,21 @@ m365 spo tenant commandset list
[
{
"FileSystemObjectType": 0,
- "Id": 9,
+ "Id": 1,
"ServerRedirectedEmbedUri": null,
"ServerRedirectedEmbedUrl": "",
- "ContentTypeId": "0x00693E2C487575B448BD420C12CEAE7EFE",
+ "ContentTypeId": "0x00DBF24546DE6018449BB43573F3581BF0",
"Title": "HelloWorld",
- "Modified": "2023-05-25T12:11:21Z",
- "Created": "2023-05-25T12:11:21Z",
+ "Modified": "2024-05-16T21:28:51Z",
+ "Created": "2024-05-16T21:28:51Z",
"AuthorId": 9,
"EditorId": 9,
"OData__UIVersionString": "1.0",
"Attachments": false,
- "GUID": "6c47dd94-f5d5-4ea8-8b39-920385a56c37",
+ "GUID": "bd123dcd-37b8-4981-aa4e-1aab50a66688",
"OData__ColorTag": null,
"ComplianceAssetId": null,
- "TenantWideExtensionComponentId": "f61d4ae8-3480-4541-930b-d641233c4fea",
+ "TenantWideExtensionComponentId": "53dd6a38-1461-44e0-9bf0-14883316a316",
"TenantWideExtensionComponentProperties": "{\"sampleTextOne\":\"One item is selected in the list.\", \"sampleTextTwo\":\"This command is always visible.\"}",
"TenantWideExtensionWebTemplate": null,
"TenantWideExtensionListTemplate": 100,
@@ -67,17 +67,17 @@ m365 spo tenant commandset list
```text
- TenantWideExtensionComponentId : f61d4ae8-3480-4541-930b-d641233c4fea
- TenantWideExtensionListTemplate: 100
- Title : HelloWorld
+ TenantWideExtensionComponentId TenantWideExtensionListTemplate Title
+ ------------------------------------ ------------------------------- ----------
+ 53dd6a38-1461-44e0-9bf0-14883316a316 100 HelloWorld
```
```csv
- FileSystemObjectType,Id,ServerRedirectedEmbedUrl,ContentTypeId,Title,Modified,Created,AuthorId,EditorId,OData__UIVersionString,Attachments,GUID,TenantWideExtensionComponentId,TenantWideExtensionComponentProperties,TenantWideExtensionListTemplate,TenantWideExtensionLocation,TenantWideExtensionSequence,TenantWideExtensionDisabled
- 0,9,,0x00693E2C487575B448BD420C12CEAE7EFE,HelloWorld,2023-05-25T12:11:21Z,2023-05-25T12:11:21Z,9,9,1.0,,6c47dd94-f5d5-4ea8-8b39-920385a56c37,f61d4ae8-3480-4541-930b-d641233c4fea,"{""sampleTextOne"":""One item is selected in the list."", ""sampleTextTwo"":""This command is always visible.""}",100,ClientSideExtension.ListViewCommandSet.CommandBar,0,
+ FileSystemObjectType,Id,ServerRedirectedEmbedUri,ServerRedirectedEmbedUrl,ContentTypeId,Title,Modified,Created,AuthorId,EditorId,OData__UIVersionString,Attachments,GUID,OData__ColorTag,ComplianceAssetId,TenantWideExtensionComponentId,TenantWideExtensionComponentProperties,TenantWideExtensionWebTemplate,TenantWideExtensionListTemplate,TenantWideExtensionLocation,TenantWideExtensionSequence,TenantWideExtensionHostProperties,TenantWideExtensionDisabled
+ 0,1,,,0x00DBF24546DE6018449BB43573F3581BF0,HelloWorld,2024-05-16T21:28:51Z,2024-05-16T21:28:51Z,9,9,1.0,,bd123dcd-37b8-4981-aa4e-1aab50a66688,,,53dd6a38-1461-44e0-9bf0-14883316a316,"{""sampleTextOne"":""One item is selected in the list."", ""sampleTextTwo"":""This command is always visible.""}",,100,ClientSideExtension.ListViewCommandSet.CommandBar,0,,
```
@@ -86,25 +86,26 @@ m365 spo tenant commandset list
```md
# spo tenant commandset list
- Date: 5/25/2023
+ Date: 16/05/2024
- ## HelloWorld (9)
+ ## HelloWorld (1)
Property | Value
---------|-------
FileSystemObjectType | 0
- Id | 9
+ Id | 1
ServerRedirectedEmbedUrl |
- ContentTypeId | 0x00693E2C487575B448BD420C12CEAE7EFE
+ ContentTypeId | 0x00DBF24546DE6018449BB43573F3581BF0
Title | HelloWorld
- Modified | 2023-05-25T12:11:21Z
- Created | 2023-05-25T12:11:21Z
+ Modified | 2024-05-16T21:28:51Z
+ Created | 2024-05-16T21:28:51Z
AuthorId | 9
EditorId | 9
OData\_\_UIVersionString | 1.0
Attachments | false
- GUID | 6c47dd94-f5d5-4ea8-8b39-920385a56c37
- TenantWideExtensionComponentId | f61d4ae8-3480-4541-930b-d641233c4fea
+ GUID | bd123dcd-37b8-4981-aa4e-1aab50a66688
+ TenantWideExtensionComponentId | 53dd6a38-1461-44e0-9bf0-14883316a316
+ TenantWideExtensionComponentProperties | {"sampleTextOne":"One item is selected in the list.", "sampleTextTwo":"This command is always visible."}
TenantWideExtensionListTemplate | 100
TenantWideExtensionLocation | ClientSideExtension.ListViewCommandSet.CommandBar
TenantWideExtensionSequence | 0
diff --git a/src/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.spec.ts b/src/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.spec.ts
index f9f5f2c83b9..2e7d837536f 100644
--- a/src/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.spec.ts
+++ b/src/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.spec.ts
@@ -21,7 +21,7 @@ describe(commands.APPLICATIONCUSTOMIZER_GET, () => {
const webUrl = 'https://contoso.sharepoint.com/sites/sales';
const applicationCustomizerGetResponse = {
"ClientSideComponentId": clientSideComponentId,
- "ClientSideComponentProperties": "",
+ "ClientSideComponentProperties": "{\"testMessage\":\"Test message\"}",
"CommandUIExtension": null,
"Description": null,
"Group": null,
@@ -49,7 +49,7 @@ describe(commands.APPLICATIONCUSTOMIZER_GET, () => {
const applicationCustomizerGetOutput = {
ClientSideComponentId: '7096cded-b83d-4eab-96f0-df477ed7c0bc',
- ClientSideComponentProperties: '',
+ ClientSideComponentProperties: '{"testMessage":"Test message"}',
CommandUIExtension: null,
Description: null,
Group: null,
@@ -288,7 +288,7 @@ describe(commands.APPLICATIONCUSTOMIZER_GET, () => {
}
});
- assert(loggerLogSpy.calledWith(applicationCustomizerGetOutput));
+ assert(loggerLogSpy.calledOnceWithExactly(applicationCustomizerGetOutput));
});
it('retrieves an application customizer by title', async () => {
@@ -314,7 +314,7 @@ describe(commands.APPLICATIONCUSTOMIZER_GET, () => {
}
});
- assert(loggerLogSpy.calledWith(applicationCustomizerGetOutput));
+ assert(loggerLogSpy.calledOnceWithExactly(applicationCustomizerGetOutput));
});
it('retrieves an application customizer by clientSideComponentId', async () => {
@@ -340,7 +340,27 @@ describe(commands.APPLICATIONCUSTOMIZER_GET, () => {
}
});
- assert(loggerLogSpy.calledWith(applicationCustomizerGetOutput));
+ assert(loggerLogSpy.calledOnceWithExactly(applicationCustomizerGetOutput));
+ });
+
+ it('retrieves application customizer properties', async () => {
+ sinon.stub(request, 'get').callsFake(async (opts) => {
+ if (opts.url === `${webUrl}/_api/Web/UserCustomActions(guid'14125658-a9bc-4ddf-9c75-1b5767c9a337')`) {
+ return applicationCustomizerGetResponse;
+ }
+
+ throw 'Invalid request';
+ });
+
+ await command.action(logger, {
+ options: {
+ id: id,
+ webUrl: webUrl,
+ clientSideComponentProperties: true
+ }
+ });
+
+ assert(loggerLogSpy.calledOnceWithExactly(JSON.parse(applicationCustomizerGetOutput.ClientSideComponentProperties)));
});
it('handles error when no application customizer with the specified id found', async () => {
@@ -612,7 +632,7 @@ describe(commands.APPLICATIONCUSTOMIZER_GET, () => {
sinon.stub(cli, 'handleMultipleResultsFound').resolves({
ClientSideComponentId: '7096cded-b83d-4eab-96f0-df477ed7c0bc',
- ClientSideComponentProperties: '',
+ ClientSideComponentProperties: '{"testMessage":"Test message"}',
CommandUIExtension: null,
Description: null,
Group: null,
@@ -640,7 +660,7 @@ describe(commands.APPLICATIONCUSTOMIZER_GET, () => {
}
});
- assert(loggerLogSpy.calledWith(applicationCustomizerGetOutput));
+ assert(loggerLogSpy.calledOnceWithExactly(applicationCustomizerGetOutput));
});
it('handles error when no valid application customizer with the specified id found', async () => {
diff --git a/src/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.ts b/src/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.ts
index 288d9241301..911cc22e47c 100644
--- a/src/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.ts
+++ b/src/m365/spo/commands/applicationcustomizer/applicationcustomizer-get.ts
@@ -18,6 +18,7 @@ interface Options extends GlobalOptions {
id?: string;
clientSideComponentId?: string;
scope?: string;
+ clientSideComponentProperties?: boolean;
}
class SpoApplicationCustomizerGetCommand extends SpoCommand {
@@ -38,6 +39,7 @@ class SpoApplicationCustomizerGetCommand extends SpoCommand {
this.#initOptions();
this.#initValidators();
this.#initOptionSets();
+ this.#initTypes();
}
#initTelemetry(): void {
@@ -46,7 +48,8 @@ class SpoApplicationCustomizerGetCommand extends SpoCommand {
title: typeof args.options.title !== 'undefined',
id: typeof args.options.id !== 'undefined',
clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
- scope: typeof args.options.scope !== 'undefined'
+ scope: typeof args.options.scope !== 'undefined',
+ clientSideComponentProperties: !!args.options.clientSideComponentProperties
});
});
}
@@ -69,6 +72,9 @@ class SpoApplicationCustomizerGetCommand extends SpoCommand {
option: '-s, --scope [scope]',
autocomplete: this.allowedScopes
},
+ {
+ option: '-p, --clientSideComponentProperties'
+ }
);
}
@@ -96,40 +102,33 @@ class SpoApplicationCustomizerGetCommand extends SpoCommand {
this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
}
+ #initTypes(): void {
+ this.types.string.push('webUrl', 'title', 'id', 'clientSideComponentId', 'scope');
+ this.types.boolean.push('clientSideComponentProperties');
+ }
+
public async commandAction(logger: Logger, args: CommandArgs): Promise {
try {
const customAction = await this.getCustomAction(args.options);
- if (customAction) {
+ if (!args.options.clientSideComponentProperties) {
await logger.log({
- ClientSideComponentId: customAction.ClientSideComponentId,
- ClientSideComponentProperties: customAction.ClientSideComponentProperties,
- CommandUIExtension: customAction.CommandUIExtension,
- Description: customAction.Description,
- Group: customAction.Group,
- Id: customAction.Id,
- ImageUrl: customAction.ImageUrl,
- Location: customAction.Location,
- Name: customAction.Name,
- RegistrationId: customAction.RegistrationId,
- RegistrationType: customAction.RegistrationType,
+ ...customAction,
Rights: JSON.stringify(customAction.Rights),
- Scope: this.humanizeScope(customAction.Scope),
- ScriptBlock: customAction.ScriptBlock,
- ScriptSrc: customAction.ScriptSrc,
- Sequence: customAction.Sequence,
- Title: customAction.Title,
- Url: customAction.Url,
- VersionOfUserCustomAction: customAction.VersionOfUserCustomAction
+ Scope: this.humanizeScope(customAction.Scope)
});
}
+ else {
+ const properties = formatting.tryParseJson(customAction.ClientSideComponentProperties);
+ await logger.log(properties);
+ }
}
catch (err: any) {
this.handleRejectedPromise(err);
}
}
- private async getCustomAction(options: Options): Promise {
+ private async getCustomAction(options: Options): Promise {
if (options.id) {
const customAction = await spo.getCustomActionById(options.webUrl, options.id, options.scope);
@@ -140,7 +139,7 @@ class SpoApplicationCustomizerGetCommand extends SpoCommand {
return customAction;
}
- const filter = options.title ? `Title eq '${formatting.encodeQueryParameter(options.title as string)}'` : `ClientSideComponentId eq guid'${formatting.encodeQueryParameter(options.clientSideComponentId as string)}'`;
+ const filter = options.title ? `Title eq '${formatting.encodeQueryParameter(options.title as string)}'` : `ClientSideComponentId eq guid'${formatting.encodeQueryParameter(options.clientSideComponentId!)}'`;
const customActions = await spo.getCustomActions(options.webUrl, options.scope, `${filter} and Location eq 'ClientSideExtension.ApplicationCustomizer'`);
if (customActions.length === 1) {
diff --git a/src/m365/spo/commands/commandset/commandset-get.spec.ts b/src/m365/spo/commands/commandset/commandset-get.spec.ts
index 1ad2f4895c3..bde853ec0aa 100644
--- a/src/m365/spo/commands/commandset/commandset-get.spec.ts
+++ b/src/m365/spo/commands/commandset/commandset-get.spec.ts
@@ -21,7 +21,7 @@ describe(commands.COMMANDSET_GET, () => {
const commandSetId = '0a8e82b5-651f-400b-b537-9a739f92d6b4';
const clientSideComponentId = '2397e6ef-4b89-4508-aea2-e375e312c76d';
const commandSetTitle = 'Alerts';
- const commandSetObject = { 'ClientSideComponentId': clientSideComponentId, 'ClientSideComponentProperties': '', 'CommandUIExtension': null, 'Description': null, 'Group': null, 'HostProperties': '', 'Id': commandSetId, 'ImageUrl': null, 'Location': 'ClientSideExtension.ListViewCommandSet.CommandBar', 'Name': '{0a8e82b5-651f-400b-b537-9a739f92d6b4}', 'RegistrationId': '119', 'RegistrationType': 1, 'Rights': { 'High': 0, 'Low': 0 }, 'Scope': 3, 'ScriptBlock': null, 'ScriptSrc': null, 'Sequence': 65536, 'Title': commandSetTitle, 'Url': null, 'VersionOfUserCustomAction': '1.0.1.0' };
+ const commandSetObject = { 'ClientSideComponentId': clientSideComponentId, 'ClientSideComponentProperties': '{"sampleTextOne":"One item is selected in the list.", "sampleTextTwo":"This command is always visible."}', 'CommandUIExtension': null, 'Description': null, 'Group': null, 'HostProperties': '', 'Id': commandSetId, 'ImageUrl': null, 'Location': 'ClientSideExtension.ListViewCommandSet.CommandBar', 'Name': '{0a8e82b5-651f-400b-b537-9a739f92d6b4}', 'RegistrationId': '119', 'RegistrationType': 1, 'Rights': { 'High': 0, 'Low': 0 }, 'Scope': 3, 'ScriptBlock': null, 'ScriptSrc': null, 'Sequence': 65536, 'Title': commandSetTitle, 'Url': null, 'VersionOfUserCustomAction': '1.0.1.0' };
const commandSetResponse: any[] = [commandSetObject];
let log: string[];
@@ -93,7 +93,7 @@ describe(commands.COMMANDSET_GET, () => {
});
await command.action(logger, { options: { webUrl: webUrl, id: commandSetId, scope: scope, verbose: true } });
- assert(loggerLogSpy.calledWith(commandSetObject));
+ assert(loggerLogSpy.calledOnceWithExactly(commandSetObject));
});
it('gets command set from specific site by title with scope "Site"', async () => {
@@ -106,7 +106,7 @@ describe(commands.COMMANDSET_GET, () => {
});
await command.action(logger, { options: { webUrl: webUrl, title: commandSetTitle, scope: scope, verbose: true } });
- assert(loggerLogSpy.calledWith(commandSetObject));
+ assert(loggerLogSpy.calledOnceWithExactly(commandSetObject));
});
it('gets command set from specific site by clientSideComponentId without specifying scope', async () => {
@@ -121,7 +121,7 @@ describe(commands.COMMANDSET_GET, () => {
});
await command.action(logger, { options: { webUrl: webUrl, clientSideComponentId: clientSideComponentId, verbose: true } });
- assert(loggerLogSpy.calledWith(commandSetObject));
+ assert(loggerLogSpy.calledOnceWithExactly(commandSetObject));
});
it('throws error when command set not found by id', async () => {
@@ -233,7 +233,44 @@ describe(commands.COMMANDSET_GET, () => {
});
await command.action(logger, { options: { webUrl: webUrl, title: commandSetTitle, scope: scope, verbose: true } });
- assert(loggerLogSpy.calledWith(commandSetObject));
+ assert(loggerLogSpy.calledOnceWithExactly(commandSetObject));
+ });
+
+ it('gets client side component properties from a command set by id', async () => {
+ sinon.stub(request, 'get').callsFake(async (opts) => {
+ if (opts.url === `${webUrl}/_api/Web/UserCustomActions(guid'${commandSetId}')`) {
+ return commandSetObject;
+ }
+ throw 'Invalid request';
+ });
+
+ await command.action(logger, { options: { webUrl: webUrl, id: commandSetId, clientSideComponentProperties: true } });
+ assert(loggerLogSpy.calledOnceWithExactly(JSON.parse(commandSetObject.ClientSideComponentProperties)));
+ });
+
+ it('gets malformed client side component properties from a command set by id', async () => {
+ const requestResult = { ...commandSetObject, ClientSideComponentProperties: '{"sampleTextOne": One item is selected in the list.}' };
+ sinon.stub(request, 'get').callsFake(async (opts) => {
+ if (opts.url === `${webUrl}/_api/Web/UserCustomActions(guid'${commandSetId}')`) {
+ return requestResult;
+ }
+ throw 'Invalid request';
+ });
+
+ await command.action(logger, { options: { webUrl: webUrl, id: commandSetId, clientSideComponentProperties: true } });
+ assert(loggerLogSpy.calledOnceWithExactly(requestResult.ClientSideComponentProperties));
+ });
+
+ it('gets undefined client side component properties from a command set by id', async () => {
+ sinon.stub(request, 'get').callsFake(async (opts) => {
+ if (opts.url === `${webUrl}/_api/Web/UserCustomActions(guid'${commandSetId}')`) {
+ return { ...commandSetObject, ClientSideComponentProperties: undefined };
+ }
+ throw 'Invalid request';
+ });
+
+ await command.action(logger, { options: { webUrl: webUrl, id: commandSetId, clientSideComponentProperties: true } });
+ assert(loggerLogSpy.calledOnceWithExactly(undefined));
});
it('fails validation if the url option is not a valid SharePoint site URL', async () => {
diff --git a/src/m365/spo/commands/commandset/commandset-get.ts b/src/m365/spo/commands/commandset/commandset-get.ts
index c26bc746de6..36e32e95716 100644
--- a/src/m365/spo/commands/commandset/commandset-get.ts
+++ b/src/m365/spo/commands/commandset/commandset-get.ts
@@ -18,6 +18,7 @@ interface Options extends GlobalOptions {
id?: string;
clientSideComponentId?: string;
scope?: string;
+ clientSideComponentProperties?: boolean;
}
class SpoCommandSetGetCommand extends SpoCommand {
@@ -40,6 +41,7 @@ class SpoCommandSetGetCommand extends SpoCommand {
this.#initOptions();
this.#initValidators();
this.#initOptionSets();
+ this.#initTypes();
}
#initTelemetry(): void {
@@ -48,7 +50,8 @@ class SpoCommandSetGetCommand extends SpoCommand {
title: typeof args.options.title !== 'undefined',
id: typeof args.options.id !== 'undefined',
clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
- scope: typeof args.options.scope !== 'undefined'
+ scope: typeof args.options.scope !== 'undefined',
+ clientSideComponentProperties: !!args.options.clientSideComponentProperties
});
});
}
@@ -70,6 +73,9 @@ class SpoCommandSetGetCommand extends SpoCommand {
{
option: '-s, --scope [scope]',
autocomplete: SpoCommandSetGetCommand.scopes
+ },
+ {
+ option: '-p, --clientSideComponentProperties'
}
);
}
@@ -98,48 +104,61 @@ class SpoCommandSetGetCommand extends SpoCommand {
this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
}
+ #initTypes(): void {
+ this.types.string.push('webUrl', 'title', 'id', 'clientSideComponentId', 'scope');
+ this.types.boolean.push('clientSideComponentProperties');
+ }
+
public async commandAction(logger: Logger, args: CommandArgs): Promise {
try {
if (this.verbose) {
- await logger.logToStderr(`Attempt to get a specific commandset by property ${args.options.title || args.options.id || args.options.clientSideComponentId}.`);
+ await logger.logToStderr(`Attempt to get a specific Command Set by property ${args.options.title || args.options.id || args.options.clientSideComponentId}.`);
}
+ let commandSet: CustomAction;
if (args.options.id) {
- const commandSet = await spo.getCustomActionById(args.options.webUrl, args.options.id, args.options.scope);
+ const customAction = await spo.getCustomActionById(args.options.webUrl, args.options.id, args.options.scope);
- if (commandSet === undefined) {
+ if (customAction === undefined) {
throw `Command set with id ${args.options.id} can't be found.`;
}
- else if (!SpoCommandSetGetCommand.allowedCommandSetLocations.some(allowedLocation => allowedLocation === commandSet.Location)) {
+ else if (!SpoCommandSetGetCommand.allowedCommandSetLocations.some(allowedLocation => allowedLocation === customAction.Location)) {
throw `Custom action with id ${args.options.id} is not a command set.`;
}
- await logger.log(commandSet);
+ commandSet = customAction!;
}
else if (args.options.clientSideComponentId) {
const filter = `${this.getBaseFilter()} ClientSideComponentId eq guid'${args.options.clientSideComponentId}'`;
- const commandSets = await spo.getCustomActions(args.options.webUrl, args.options.scope, filter);
+ const customActions = await spo.getCustomActions(args.options.webUrl, args.options.scope, filter);
- if (commandSets.length === 0) {
+ if (customActions.length === 0) {
throw `No command set with clientSideComponentId '${args.options.clientSideComponentId}' found.`;
}
- await logger.log(commandSets[0]);
+ commandSet = customActions[0];
}
else if (args.options.title) {
const filter = `${this.getBaseFilter()} Title eq '${formatting.encodeQueryParameter(args.options.title)}'`;
- const commandSets = await spo.getCustomActions(args.options.webUrl, args.options.scope, filter);
+ const customActions = await spo.getCustomActions(args.options.webUrl, args.options.scope, filter);
- if (commandSets.length === 1) {
- await logger.log(commandSets[0]);
+ if (customActions.length === 1) {
+ commandSet = customActions[0];
}
- else if (commandSets.length === 0) {
+ else if (customActions.length === 0) {
throw `No command set with title '${args.options.title}' found.`;
}
else {
- const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', commandSets);
- const commandSet = await cli.handleMultipleResultsFound(`Multiple command sets with title '${args.options.title}' found.`, resultAsKeyValuePair);
- await logger.log(commandSet);
+ const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', customActions);
+ commandSet = await cli.handleMultipleResultsFound(`Multiple command sets with title '${args.options.title}' found.`, resultAsKeyValuePair);
}
}
+
+ if (!args.options.clientSideComponentProperties) {
+ await logger.log(commandSet!);
+ }
+ else {
+ const properties = formatting.tryParseJson(commandSet!.ClientSideComponentProperties);
+ await logger.log(properties);
+ }
}
catch (err: any) {
this.handleRejectedODataJsonPromise(err);
diff --git a/src/m365/spo/commands/tenant/tenant-applicationcustomizer-get.spec.ts b/src/m365/spo/commands/tenant/tenant-applicationcustomizer-get.spec.ts
index 8a423c2a641..a3ea45243c8 100644
--- a/src/m365/spo/commands/tenant/tenant-applicationcustomizer-get.spec.ts
+++ b/src/m365/spo/commands/tenant/tenant-applicationcustomizer-get.spec.ts
@@ -269,7 +269,7 @@ describe(commands.TENANT_APPLICATIONCUSTOMIZER_GET, () => {
title: title
}
});
- assert(loggerLogSpy.calledWith(applicationCustomizerResponse.value[0]));
+ assert(loggerLogSpy.calledOnceWithExactly(applicationCustomizerResponse.value[0]));
});
it('handles error when multiple application customizers with the specified title found', async () => {
@@ -332,7 +332,7 @@ describe(commands.TENANT_APPLICATIONCUSTOMIZER_GET, () => {
title: title
}
});
- assert(loggerLogSpy.calledWith(applicationCustomizerResponse.value[0]));
+ assert(loggerLogSpy.calledOnceWithExactly(applicationCustomizerResponse.value[0]));
});
it('retrieves an application customizer by id', async () => {
@@ -353,7 +353,7 @@ describe(commands.TENANT_APPLICATIONCUSTOMIZER_GET, () => {
id: id
}
});
- assert(loggerLogSpy.calledWith(applicationCustomizerResponse.value[0]));
+ assert(loggerLogSpy.calledOnceWithExactly(applicationCustomizerResponse.value[0]));
});
it('retrieves an application customizer by clientSideComponentId', async () => {
@@ -374,7 +374,29 @@ describe(commands.TENANT_APPLICATIONCUSTOMIZER_GET, () => {
clientSideComponentId: clientSideComponentId
}
});
- assert(loggerLogSpy.calledWith(applicationCustomizerResponse.value[0]));
+ assert(loggerLogSpy.calledOnceWithExactly(applicationCustomizerResponse.value[0]));
+ });
+
+ it('retrieves an application customizer component properties', async () => {
+ sinon.stub(request, 'get').callsFake(async (opts) => {
+ if (opts.url === `${spoUrl}/_api/SP_TenantSettings_Current`) {
+ return { CorporateCatalogUrl: appCatalogUrl };
+ }
+
+ if (opts.url === `https://contoso.sharepoint.com/sites/apps/_api/web/GetList('%2Fsites%2Fapps%2Flists%2FTenantWideExtensions')/items?$filter=TenantWideExtensionLocation eq 'ClientSideExtension.ApplicationCustomizer' and Id eq '4'`) {
+ return applicationCustomizerResponse;
+ }
+
+ throw 'Invalid request';
+ });
+
+ await command.action(logger, {
+ options: {
+ id: id,
+ tenantWideExtensionComponentProperties: true
+ }
+ });
+ assert(loggerLogSpy.calledOnceWithExactly(JSON.parse(applicationCustomizerResponse.value[0].TenantWideExtensionComponentProperties)));
});
it('handles error when multiple application customizers with the clientSideComponentId found', async () => {
diff --git a/src/m365/spo/commands/tenant/tenant-applicationcustomizer-get.ts b/src/m365/spo/commands/tenant/tenant-applicationcustomizer-get.ts
index acae0da8fd2..6b0c74a862b 100644
--- a/src/m365/spo/commands/tenant/tenant-applicationcustomizer-get.ts
+++ b/src/m365/spo/commands/tenant/tenant-applicationcustomizer-get.ts
@@ -18,6 +18,7 @@ interface Options extends GlobalOptions {
title?: string;
id?: string;
clientSideComponentId?: string;
+ tenantWideExtensionComponentProperties?: boolean;
}
class SpoTenantApplicationCustomizerGetCommand extends SpoCommand {
@@ -36,6 +37,7 @@ class SpoTenantApplicationCustomizerGetCommand extends SpoCommand {
this.#initOptions();
this.#initValidators();
this.#initOptionSets();
+ this.#initTypes();
}
#initTelemetry(): void {
@@ -43,7 +45,8 @@ class SpoTenantApplicationCustomizerGetCommand extends SpoCommand {
Object.assign(this.telemetryProperties, {
title: typeof args.options.title !== 'undefined',
id: typeof args.options.id !== 'undefined',
- clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined'
+ clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
+ tenantWideExtensionComponentProperties: !!args.options.tenantWideExtensionComponentProperties
});
});
}
@@ -58,6 +61,9 @@ class SpoTenantApplicationCustomizerGetCommand extends SpoCommand {
},
{
option: '-c, --clientSideComponentId [clientSideComponentId]'
+ },
+ {
+ option: '-p, --tenantWideExtensionComponentProperties'
}
);
}
@@ -82,6 +88,11 @@ class SpoTenantApplicationCustomizerGetCommand extends SpoCommand {
this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
}
+ #initTypes(): void {
+ this.types.string.push('title', 'id', 'clientSideComponentId');
+ this.types.boolean.push('tenantWideExtensionComponentProperties');
+ }
+
public async commandAction(logger: Logger, args: CommandArgs): Promise {
try {
const appCatalogUrl = await spo.getTenantAppCatalogUrl(logger, this.debug);
@@ -111,13 +122,21 @@ class SpoTenantApplicationCustomizerGetCommand extends SpoCommand {
listItemInstances.forEach(v => delete (v as any)['ID']);
+ let listItemInstance: ListItemInstance;
if (listItemInstances.length > 1) {
const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', listItemInstances);
- const result = await cli.handleMultipleResultsFound(`Multiple application customizers with ${args.options.title || args.options.clientSideComponentId} were found.`, resultAsKeyValuePair);
- await logger.log(result);
+ listItemInstance = await cli.handleMultipleResultsFound(`Multiple application customizers with ${args.options.title || args.options.clientSideComponentId} were found.`, resultAsKeyValuePair);
+ }
+ else {
+ listItemInstance = listItemInstances[0];
+ }
+
+ if (!args.options.tenantWideExtensionComponentProperties) {
+ await logger.log(listItemInstance);
}
else {
- await logger.log(listItemInstances[0]);
+ const properties = formatting.tryParseJson((listItemInstance as any).TenantWideExtensionComponentProperties);
+ await logger.log(properties);
}
}
else {
diff --git a/src/m365/spo/commands/tenant/tenant-commandset-get.spec.ts b/src/m365/spo/commands/tenant/tenant-commandset-get.spec.ts
index f37f65d86d1..aa2db56eb68 100644
--- a/src/m365/spo/commands/tenant/tenant-commandset-get.spec.ts
+++ b/src/m365/spo/commands/tenant/tenant-commandset-get.spec.ts
@@ -62,7 +62,7 @@ describe(commands.TENANT_COMMANDSET_GET, () => {
auth.connection.spoUrl = spoUrl;
commandInfo = cli.getCommandInfo(command);
sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName: string, defaultValue: any) => {
- if (settingName === 'prompt') {
+ if (settingName === settingsNames.prompt) {
return false;
}
@@ -89,8 +89,7 @@ describe(commands.TENANT_COMMANDSET_GET, () => {
afterEach(() => {
sinonUtil.restore([
request.get,
- cli.handleMultipleResultsFound,
- cli.getSettingWithDefaultValue
+ cli.handleMultipleResultsFound
]);
});
@@ -119,14 +118,6 @@ describe(commands.TENANT_COMMANDSET_GET, () => {
});
it('fails validation when all options are specified', async () => {
- sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => {
- if (settingName === settingsNames.prompt) {
- return false;
- }
-
- return defaultValue;
- });
-
const actual = await command.validate({
options: {
title: title,
@@ -138,14 +129,6 @@ describe(commands.TENANT_COMMANDSET_GET, () => {
});
it('fails validation when no options are specified', async () => {
- sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => {
- if (settingName === settingsNames.prompt) {
- return false;
- }
-
- return defaultValue;
- });
-
const actual = await command.validate({
options: {
}
@@ -154,14 +137,6 @@ describe(commands.TENANT_COMMANDSET_GET, () => {
});
it('fails validation when title and id options are specified', async () => {
- sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => {
- if (settingName === settingsNames.prompt) {
- return false;
- }
-
- return defaultValue;
- });
-
const actual = await command.validate({
options: {
title: title,
@@ -172,14 +147,6 @@ describe(commands.TENANT_COMMANDSET_GET, () => {
});
it('fails validation when title and clientSideComponentId options are specified', async () => {
- sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => {
- if (settingName === settingsNames.prompt) {
- return false;
- }
-
- return defaultValue;
- });
-
const actual = await command.validate({
options: {
title: title,
@@ -190,14 +157,6 @@ describe(commands.TENANT_COMMANDSET_GET, () => {
});
it('fails validation when id and clientSideComponentId options are specified', async () => {
- sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => {
- if (settingName === settingsNames.prompt) {
- return false;
- }
-
- return defaultValue;
- });
-
const actual = await command.validate({
options: {
id: id,
@@ -276,18 +235,10 @@ describe(commands.TENANT_COMMANDSET_GET, () => {
title: title
}
});
- assert(loggerLogSpy.calledWith(commandSetResponse.value[0]));
+ assert(loggerLogSpy.calledOnceWithExactly(commandSetResponse.value[0]));
});
it('handles error when multiple command sets with the specified title found', async () => {
- sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => {
- if (settingName === settingsNames.prompt) {
- return false;
- }
-
- return defaultValue;
- });
-
sinon.stub(request, 'get').callsFake(async (opts) => {
if (opts.url === `${spoUrl}/_api/SP_TenantSettings_Current`) {
return { CorporateCatalogUrl: appCatalogUrl };
@@ -339,7 +290,7 @@ describe(commands.TENANT_COMMANDSET_GET, () => {
title: title
}
});
- assert(loggerLogSpy.calledWith(commandSetResponse.value[0]));
+ assert(loggerLogSpy.calledOnceWithExactly(commandSetResponse.value[0]));
});
it('retrieves a command set by id', async () => {
@@ -360,7 +311,7 @@ describe(commands.TENANT_COMMANDSET_GET, () => {
id: id
}
});
- assert(loggerLogSpy.calledWith(commandSetResponse.value[0]));
+ assert(loggerLogSpy.calledOnceWithExactly(commandSetResponse.value[0]));
});
it('retrieves a command set by clientSideComponentId', async () => {
@@ -381,18 +332,32 @@ describe(commands.TENANT_COMMANDSET_GET, () => {
clientSideComponentId: clientSideComponentId
}
});
- assert(loggerLogSpy.calledWith(commandSetResponse.value[0]));
+ assert(loggerLogSpy.calledOnceWithExactly(commandSetResponse.value[0]));
});
- it('handles error when multiple command sets with the clientSideComponentId found', async () => {
- sinon.stub(cli, 'getSettingWithDefaultValue').callsFake((settingName, defaultValue) => {
- if (settingName === settingsNames.prompt) {
- return false;
+ it('retrieves command set properties', async () => {
+ sinon.stub(request, 'get').callsFake(async (opts) => {
+ if (opts.url === `${spoUrl}/_api/SP_TenantSettings_Current`) {
+ return { CorporateCatalogUrl: appCatalogUrl };
}
- return defaultValue;
+ if (opts.url === `https://contoso.sharepoint.com/sites/apps/_api/web/GetList('%2Fsites%2Fapps%2Flists%2FTenantWideExtensions')/items?$filter=startswith(TenantWideExtensionLocation,'ClientSideExtension.ListViewCommandSet') and Id eq 4`) {
+ return commandSetResponse;
+ }
+
+ throw 'Invalid request';
});
+ await command.action(logger, {
+ options: {
+ id: id,
+ tenantWideExtensionComponentProperties: true
+ }
+ });
+ assert(loggerLogSpy.calledOnceWithExactly(JSON.parse(commandSetResponse.value[0].TenantWideExtensionComponentProperties)));
+ });
+
+ it('handles error when multiple command sets with the clientSideComponentId found', async () => {
sinon.stub(request, 'get').callsFake(async (opts) => {
if (opts.url === `${spoUrl}/_api/SP_TenantSettings_Current`) {
return { CorporateCatalogUrl: appCatalogUrl };
diff --git a/src/m365/spo/commands/tenant/tenant-commandset-get.ts b/src/m365/spo/commands/tenant/tenant-commandset-get.ts
index 88e5c163c75..29193fc7814 100644
--- a/src/m365/spo/commands/tenant/tenant-commandset-get.ts
+++ b/src/m365/spo/commands/tenant/tenant-commandset-get.ts
@@ -20,6 +20,7 @@ interface Options extends GlobalOptions {
title?: string;
id?: string;
clientSideComponentId?: string;
+ tenantWideExtensionComponentProperties?: boolean;
}
class SpoTenantCommandSetGetCommand extends SpoCommand {
@@ -38,6 +39,7 @@ class SpoTenantCommandSetGetCommand extends SpoCommand {
this.#initOptions();
this.#initValidators();
this.#initOptionSets();
+ this.#initTypes();
}
#initTelemetry(): void {
@@ -45,7 +47,8 @@ class SpoTenantCommandSetGetCommand extends SpoCommand {
Object.assign(this.telemetryProperties, {
title: typeof args.options.title !== 'undefined',
id: typeof args.options.id !== 'undefined',
- clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined'
+ clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
+ tenantWideExtensionComponentProperties: !!args.options.tenantWideExtensionComponentProperties
});
});
}
@@ -60,6 +63,9 @@ class SpoTenantCommandSetGetCommand extends SpoCommand {
},
{
option: '-c, --clientSideComponentId [clientSideComponentId]'
+ },
+ {
+ option: '-p, --tenantWideExtensionComponentProperties'
}
);
}
@@ -84,6 +90,11 @@ class SpoTenantCommandSetGetCommand extends SpoCommand {
this.optionSets.push({ options: ['title', 'id', 'clientSideComponentId'] });
}
+ #initTypes(): void {
+ this.types.string.push('title', 'id', 'clientSideComponentId');
+ this.types.boolean.push('tenantWideExtensionComponentProperties');
+ }
+
public async commandAction(logger: Logger, args: CommandArgs): Promise {
const appCatalogUrl = await spo.getTenantAppCatalogUrl(logger, this.debug);
if (!appCatalogUrl) {
@@ -106,7 +117,7 @@ class SpoTenantCommandSetGetCommand extends SpoCommand {
const reqOptions: CliRequestOptions = {
url: `${appCatalogUrl}/_api/web/GetList('${formatting.encodeQueryParameter(listServerRelativeUrl)}')/items?$filter=${filter}`,
headers: {
- 'accept': 'application/json;odata=nometadata'
+ accept: 'application/json;odata=nometadata'
},
responseType: 'json'
};
@@ -117,13 +128,21 @@ class SpoTenantCommandSetGetCommand extends SpoCommand {
if (listItemInstances?.value.length > 0) {
listItemInstances.value.forEach(v => delete v['ID']);
+ let listItemInstance: ListItemInstance;
if (listItemInstances.value.length > 1) {
const resultAsKeyValuePair = formatting.convertArrayToHashTable('Id', listItemInstances.value);
- const result = await cli.handleMultipleResultsFound(`Multiple ListView Command Sets with ${args.options.title || args.options.clientSideComponentId} were found.`, resultAsKeyValuePair);
- await logger.log(result);
+ listItemInstance = await cli.handleMultipleResultsFound(`Multiple ListView Command Sets with ${args.options.title || args.options.clientSideComponentId} were found.`, resultAsKeyValuePair);
+ }
+ else {
+ listItemInstance = listItemInstances.value[0];
+ }
+
+ if (!args.options.tenantWideExtensionComponentProperties) {
+ await logger.log(listItemInstance);
}
else {
- await logger.log(listItemInstances.value[0]);
+ const properties = formatting.tryParseJson((listItemInstance as any).TenantWideExtensionComponentProperties);
+ await logger.log(properties);
}
}
else {
diff --git a/src/utils/formatting.ts b/src/utils/formatting.ts
index 61f1f56057c..c7c7fb95f38 100644
--- a/src/utils/formatting.ts
+++ b/src/utils/formatting.ts
@@ -46,6 +46,24 @@ export const formatting = {
return JSON.parse(s.replace(/^\uFEFF/, ''));
},
+ /**
+ * Tries to parse a string as JSON. If it fails, returns the original string.
+ * @param value JSON string to parse.
+ * @returns JSON object or the original string if parsing fails.
+ */
+ tryParseJson(value: string): any {
+ try {
+ if (typeof value !== 'string') {
+ return value;
+ }
+
+ return JSON.parse(value);
+ }
+ catch {
+ return value;
+ }
+ },
+
filterObject(obj: any, propertiesToInclude: string[]): any {
const objKeys = Object.keys(obj);
return propertiesToInclude