@pnp/cli-microsoft365 11.2.0-beta.0432e1f → 11.2.0-beta.a01f353

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,11 @@
1
1
  import { cli } from '../../cli/cli.js';
2
+ import { globalOptionsZod } from '../../Command.js';
2
3
  import { settingsNames } from '../../settingsNames.js';
3
4
  import { app } from '../../utils/app.js';
4
5
  import { browserUtil } from '../../utils/browserUtil.js';
5
6
  import AnonymousCommand from '../base/AnonymousCommand.js';
6
7
  import commands from './commands.js';
8
+ const options = globalOptionsZod.strict();
7
9
  class DocsCommand extends AnonymousCommand {
8
10
  get name() {
9
11
  return commands.DOCS;
@@ -11,6 +13,9 @@ class DocsCommand extends AnonymousCommand {
11
13
  get description() {
12
14
  return 'Returns the CLI for Microsoft 365 docs webpage URL';
13
15
  }
16
+ get schema() {
17
+ return options;
18
+ }
14
19
  async commandAction(logger) {
15
20
  await logger.log(app.packageJson().homepage);
16
21
  if (cli.getSettingWithDefaultValue(settingsNames.autoOpenLinksInBrowser, false) === false) {
@@ -1,12 +1,14 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var _EntraMultitenantAddCommand_instances, _EntraMultitenantAddCommand_initTelemetry, _EntraMultitenantAddCommand_initOptions, _EntraMultitenantAddCommand_initTypes;
1
+ import { z } from 'zod';
2
+ import { globalOptionsZod } from '../../../../Command.js';
7
3
  import request from '../../../../request.js';
8
4
  import GraphCommand from '../../../base/GraphCommand.js';
9
5
  import commands from '../../commands.js';
6
+ import { zod } from '../../../../utils/zod.js';
7
+ const options = globalOptionsZod
8
+ .extend({
9
+ displayName: zod.alias('n', z.string()),
10
+ description: zod.alias('d', z.string().optional())
11
+ }).strict();
10
12
  class EntraMultitenantAddCommand extends GraphCommand {
11
13
  get name() {
12
14
  return commands.MULTITENANT_ADD;
@@ -14,12 +16,8 @@ class EntraMultitenantAddCommand extends GraphCommand {
14
16
  get description() {
15
17
  return 'Creates a new multitenant organization';
16
18
  }
17
- constructor() {
18
- super();
19
- _EntraMultitenantAddCommand_instances.add(this);
20
- __classPrivateFieldGet(this, _EntraMultitenantAddCommand_instances, "m", _EntraMultitenantAddCommand_initTelemetry).call(this);
21
- __classPrivateFieldGet(this, _EntraMultitenantAddCommand_instances, "m", _EntraMultitenantAddCommand_initOptions).call(this);
22
- __classPrivateFieldGet(this, _EntraMultitenantAddCommand_instances, "m", _EntraMultitenantAddCommand_initTypes).call(this);
19
+ get schema() {
20
+ return options;
23
21
  }
24
22
  async commandAction(logger, args) {
25
23
  if (this.verbose) {
@@ -45,21 +43,5 @@ class EntraMultitenantAddCommand extends GraphCommand {
45
43
  }
46
44
  }
47
45
  }
48
- _EntraMultitenantAddCommand_instances = new WeakSet(), _EntraMultitenantAddCommand_initTelemetry = function _EntraMultitenantAddCommand_initTelemetry() {
49
- this.telemetry.push((args) => {
50
- Object.assign(this.telemetryProperties, {
51
- displayName: typeof args.options.displayName !== 'undefined',
52
- description: typeof args.options.description !== 'undefined'
53
- });
54
- });
55
- }, _EntraMultitenantAddCommand_initOptions = function _EntraMultitenantAddCommand_initOptions() {
56
- this.options.unshift({
57
- option: '-n, --displayName <displayName>'
58
- }, {
59
- option: '-d, --description [description]'
60
- });
61
- }, _EntraMultitenantAddCommand_initTypes = function _EntraMultitenantAddCommand_initTypes() {
62
- this.types.string.push('displayName', 'description');
63
- };
64
46
  export default new EntraMultitenantAddCommand();
65
47
  //# sourceMappingURL=multitenant-add.js.map
@@ -29,6 +29,7 @@ class SpoApplicationCustomizerAddCommand extends SpoCommand {
29
29
  const requestBody = {
30
30
  Title: args.options.title,
31
31
  Name: args.options.title,
32
+ Description: args.options.description,
32
33
  Location: 'ClientSideExtension.ApplicationCustomizer',
33
34
  ClientSideComponentId: args.options.clientSideComponentId
34
35
  };
@@ -54,6 +55,8 @@ _a = SpoApplicationCustomizerAddCommand, _SpoApplicationCustomizerAddCommand_ins
54
55
  option: '-u, --webUrl <webUrl>'
55
56
  }, {
56
57
  option: '-i, --clientSideComponentId <clientSideComponentId>'
58
+ }, {
59
+ option: '--description [description]'
57
60
  }, {
58
61
  option: '--clientSideComponentProperties [clientSideComponentProperties]'
59
62
  }, {
@@ -62,6 +65,7 @@ _a = SpoApplicationCustomizerAddCommand, _SpoApplicationCustomizerAddCommand_ins
62
65
  }, _SpoApplicationCustomizerAddCommand_initTelemetry = function _SpoApplicationCustomizerAddCommand_initTelemetry() {
63
66
  this.telemetry.push((args) => {
64
67
  Object.assign(this.telemetryProperties, {
68
+ description: typeof args.options.description !== 'undefined',
65
69
  clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
66
70
  scope: typeof args.options.scope !== 'undefined'
67
71
  });
@@ -37,7 +37,7 @@ class SpoApplicationCustomizerSetCommand extends SpoCommand {
37
37
  }
38
38
  }
39
39
  async updateAppCustomizer(logger, options, appCustomizer) {
40
- const { clientSideComponentProperties, webUrl, newTitle } = options;
40
+ const { clientSideComponentProperties, webUrl, newTitle, description } = options;
41
41
  if (this.verbose) {
42
42
  await logger.logToStderr(`Updating application customizer with ID '${appCustomizer.Id}' on the site '${webUrl}'...`);
43
43
  }
@@ -45,6 +45,9 @@ class SpoApplicationCustomizerSetCommand extends SpoCommand {
45
45
  if (newTitle) {
46
46
  requestBody.Title = newTitle;
47
47
  }
48
+ if (description !== undefined) {
49
+ requestBody.Description = description;
50
+ }
48
51
  if (clientSideComponentProperties !== undefined) {
49
52
  requestBody.ClientSideComponentProperties = clientSideComponentProperties;
50
53
  }
@@ -99,6 +102,8 @@ _SpoApplicationCustomizerSetCommand_instances = new WeakSet(), _SpoApplicationCu
99
102
  option: '-c, --clientSideComponentId [clientSideComponentId]'
100
103
  }, {
101
104
  option: '--newTitle [newTitle]'
105
+ }, {
106
+ option: '--description [description]'
102
107
  }, {
103
108
  option: '-p, --clientSideComponentProperties [clientSideComponentProperties]'
104
109
  }, {
@@ -111,6 +116,7 @@ _SpoApplicationCustomizerSetCommand_instances = new WeakSet(), _SpoApplicationCu
111
116
  id: typeof args.options.id !== 'undefined',
112
117
  clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
113
118
  newTitle: typeof args.options.newTitle !== 'undefined',
119
+ description: typeof args.options.description !== 'undefined',
114
120
  clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
115
121
  scope: typeof args.options.scope !== 'undefined'
116
122
  });
@@ -126,7 +132,7 @@ _SpoApplicationCustomizerSetCommand_instances = new WeakSet(), _SpoApplicationCu
126
132
  if (args.options.scope && this.allowedScopes.indexOf(args.options.scope) === -1) {
127
133
  return `'${args.options.scope}' is not a valid application customizer scope. Allowed values are: ${this.allowedScopes.join(',')}`;
128
134
  }
129
- if (!args.options.newTitle && !args.options.clientSideComponentProperties) {
135
+ if (!args.options.newTitle && args.options.description === undefined && !args.options.clientSideComponentProperties) {
130
136
  return `Please specify an option to be updated`;
131
137
  }
132
138
  return validation.isValidSharePointUrl(args.options.webUrl);
@@ -34,6 +34,7 @@ class SpoCommandSetAddCommand extends SpoCommand {
34
34
  try {
35
35
  const requestBody = {
36
36
  Title: args.options.title,
37
+ Description: args.options.description,
37
38
  Location: location,
38
39
  ClientSideComponentId: args.options.clientSideComponentId,
39
40
  RegistrationId: listType,
@@ -81,6 +82,7 @@ class SpoCommandSetAddCommand extends SpoCommand {
81
82
  _a = SpoCommandSetAddCommand, _SpoCommandSetAddCommand_instances = new WeakSet(), _SpoCommandSetAddCommand_initTelemetry = function _SpoCommandSetAddCommand_initTelemetry() {
82
83
  this.telemetry.push((args) => {
83
84
  Object.assign(this.telemetryProperties, {
85
+ description: typeof args.options.description !== 'undefined',
84
86
  clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
85
87
  scope: typeof args.options.scope !== 'undefined',
86
88
  location: typeof args.options.location !== 'undefined'
@@ -95,6 +97,8 @@ _a = SpoCommandSetAddCommand, _SpoCommandSetAddCommand_instances = new WeakSet()
95
97
  option: '-l, --listType <listType>', autocomplete: _a.listTypes
96
98
  }, {
97
99
  option: '-i, --clientSideComponentId <clientSideComponentId>'
100
+ }, {
101
+ option: '--description [description]'
98
102
  }, {
99
103
  option: '--clientSideComponentProperties [clientSideComponentProperties]'
100
104
  }, {
@@ -39,6 +39,9 @@ class SpoCommandSetSetCommand extends SpoCommand {
39
39
  if (args.options.newTitle) {
40
40
  requestBody.Title = args.options.newTitle;
41
41
  }
42
+ if (args.options.description !== undefined) {
43
+ requestBody.Description = args.options.description;
44
+ }
42
45
  if (args.options.location) {
43
46
  requestBody.Location = location;
44
47
  }
@@ -118,6 +121,8 @@ _a = SpoCommandSetSetCommand, _SpoCommandSetSetCommand_instances = new WeakSet()
118
121
  id: typeof args.options.id !== 'undefined',
119
122
  clientSideComponentId: typeof args.options.clientSideComponentId !== 'undefined',
120
123
  newClientSideComponentId: typeof args.options.newClientSideComponentId !== 'undefined',
124
+ newTitle: typeof args.options.newTitle !== 'undefined',
125
+ description: typeof args.options.description !== 'undefined',
121
126
  listType: typeof args.options.listType !== 'undefined',
122
127
  clientSideComponentProperties: typeof args.options.clientSideComponentProperties !== 'undefined',
123
128
  scope: typeof args.options.scope !== 'undefined',
@@ -137,6 +142,8 @@ _a = SpoCommandSetSetCommand, _SpoCommandSetSetCommand_instances = new WeakSet()
137
142
  option: '--newClientSideComponentId [newClientSideComponentId]'
138
143
  }, {
139
144
  option: '--newTitle [newTitle]'
145
+ }, {
146
+ option: '--description [description]'
140
147
  }, {
141
148
  option: '-l, --listType [listType]', autocomplete: _a.listTypes
142
149
  }, {
@@ -166,7 +173,7 @@ _a = SpoCommandSetSetCommand, _SpoCommandSetSetCommand_instances = new WeakSet()
166
173
  if (args.options.location && _a.locations.indexOf(args.options.location) < 0) {
167
174
  return `${args.options.location} is not a valid location. Allowed values are ${_a.locations.join(', ')}`;
168
175
  }
169
- if (!args.options.newTitle && !args.options.listType && !args.options.clientSideComponentProperties && !args.options.location && !args.options.newClientSideComponentId) {
176
+ if (!args.options.newTitle && args.options.description === undefined && !args.options.listType && !args.options.clientSideComponentProperties && !args.options.location && !args.options.newClientSideComponentId) {
170
177
  return `Please specify option to be updated`;
171
178
  }
172
179
  return validation.isValidSharePointUrl(args.options.webUrl);
@@ -0,0 +1,69 @@
1
+ import commands from '../../commands.js';
2
+ import SpoCommand from '../../../base/SpoCommand.js';
3
+ import { globalOptionsZod } from '../../../../Command.js';
4
+ import { z } from 'zod';
5
+ import { zod } from '../../../../utils/zod.js';
6
+ import { validation } from '../../../../utils/validation.js';
7
+ import request from '../../../../request.js';
8
+ export const options = globalOptionsZod
9
+ .extend({
10
+ siteUrl: zod.alias('u', z.string()
11
+ .refine(url => validation.isValidSharePointUrl(url) === true, url => ({
12
+ message: `'${url}' is not a valid SharePoint Online site URL.`
13
+ })))
14
+ })
15
+ .strict();
16
+ class SpoSiteVersionpolicyGetCommand extends SpoCommand {
17
+ get name() {
18
+ return commands.SITE_VERSIONPOLICY_GET;
19
+ }
20
+ get description() {
21
+ return 'Retrieves the version policy settings of a specific site';
22
+ }
23
+ get schema() {
24
+ return options;
25
+ }
26
+ async commandAction(logger, args) {
27
+ if (this.verbose) {
28
+ await logger.logToStderr(`Retrieving version policy settings for site '${args.options.siteUrl}'...`);
29
+ }
30
+ try {
31
+ const requestOptions = {
32
+ url: `${args.options.siteUrl}/_api/site/VersionPolicyForNewLibrariesTemplate?$expand=VersionPolicies`,
33
+ headers: {
34
+ accept: 'application/json;odata=nometadata'
35
+ },
36
+ responseType: 'json'
37
+ };
38
+ const response = await request.get(requestOptions);
39
+ let defaultTrimMode = 'number';
40
+ if (response.MajorVersionLimit === -1) {
41
+ defaultTrimMode = 'inheritTenant';
42
+ }
43
+ else if (response.VersionPolicies) {
44
+ switch (response.VersionPolicies.DefaultTrimMode) {
45
+ case 1:
46
+ defaultTrimMode = 'age';
47
+ break;
48
+ case 2:
49
+ defaultTrimMode = 'automatic';
50
+ break;
51
+ case 0:
52
+ default:
53
+ defaultTrimMode = 'number';
54
+ }
55
+ }
56
+ const output = {
57
+ defaultTrimMode: defaultTrimMode,
58
+ defaultExpireAfterDays: response.VersionPolicies?.DefaultExpireAfterDays ?? null,
59
+ majorVersionLimit: response.MajorVersionLimit
60
+ };
61
+ await logger.log(output);
62
+ }
63
+ catch (err) {
64
+ this.handleRejectedODataJsonPromise(err);
65
+ }
66
+ }
67
+ }
68
+ export default new SpoSiteVersionpolicyGetCommand();
69
+ //# sourceMappingURL=site-versionpolicy-get.js.map
@@ -285,6 +285,7 @@ export default {
285
285
  SITE_RENAME: `${prefix} site rename`,
286
286
  SITE_SET: `${prefix} site set`,
287
287
  SITE_SHARINGPERMISSION_SET: `${prefix} site sharingpermission set`,
288
+ SITE_VERSIONPOLICY_GET: `${prefix} site versionpolicy get`,
288
289
  SITE_CHROME_SET: `${prefix} site chrome set`,
289
290
  SITE_UNARCHIVE: `${prefix} site unarchive`,
290
291
  SITEDESIGN_ADD: `${prefix} sitedesign add`,
@@ -24,6 +24,25 @@ m365 entra groupsettingtemplate get [options]
24
24
 
25
25
  <Global />
26
26
 
27
+ ## Permissions
28
+
29
+ <Tabs>
30
+ <TabItem value="Delegated">
31
+
32
+ | Resource | Permissions |
33
+ |------------------|------------------------|
34
+ | Microsoft Graph | GroupSettings.Read.All |
35
+
36
+ </TabItem>
37
+ <TabItem value="Application">
38
+
39
+ | Resource | Permissions |
40
+ |------------------|------------------------|
41
+ | Microsoft Graph | GroupSettings.Read.All |
42
+
43
+ </TabItem>
44
+ </Tabs>
45
+
27
46
  ## Examples
28
47
 
29
48
  Get information about the group setting template with id _62375ab9-6b52-47ed-826b-58e47e0e304b_
@@ -97,4 +116,4 @@ m365 entra groupsettingtemplate get --displayName Group.Unified
97
116
  ```
98
117
 
99
118
  </TabItem>
100
- </Tabs>
119
+ </Tabs>
@@ -16,6 +16,27 @@ m365 entra groupsettingtemplate list [options]
16
16
 
17
17
  <Global />
18
18
 
19
+ ## Permissions
20
+
21
+ ## Permissions
22
+
23
+ <Tabs>
24
+ <TabItem value="Delegated">
25
+
26
+ | Resource | Permissions |
27
+ |------------------|------------------------|
28
+ | Microsoft Graph | GroupSettings.Read.All |
29
+
30
+ </TabItem>
31
+ <TabItem value="Application">
32
+
33
+ | Resource | Permissions |
34
+ |------------------|------------------------|
35
+ | Microsoft Graph | GroupSettings.Read.All |
36
+
37
+ </TabItem>
38
+ </Tabs>
39
+
19
40
  ## Examples
20
41
 
21
42
  List all group setting templates in the tenant
@@ -83,4 +104,4 @@ m365 entra groupsettingtemplate list
83
104
  ```
84
105
 
85
106
  </TabItem>
86
- </Tabs>
107
+ </Tabs>
@@ -22,6 +22,9 @@ m365 spo applicationcustomizer add [options]
22
22
  `-i, --clientSideComponentId <clientSideComponentId>`
23
23
  : Client-side component ID of the application customizer (GUID).
24
24
 
25
+ `--description [description]`
26
+ : Description of the application customizer.
27
+
25
28
  `--clientSideComponentProperties [clientSideComponentProperties]`
26
29
  : JSON string with application customizer properties.
27
30
 
@@ -28,6 +28,9 @@ m365 spo applicationcustomizer set [options]
28
28
  `--newTitle [newTitle]`
29
29
  : The new title of the Application Customizer.
30
30
 
31
+ `--description [description]`
32
+ : Description of the application customizer. Specify an empty string to clear.
33
+
31
34
  `-p, --clientSideComponentProperties [clientSideComponentProperties]`
32
35
  : The Client Side Component properties of the Application Customizer.
33
36
 
@@ -27,6 +27,9 @@ m365 spo commandset add [options]
27
27
  `-i, --clientSideComponentId <clientSideComponentId>`
28
28
  : The Client Side Component Id (GUID) of the ListView Command Set.
29
29
 
30
+ `--description [description]`
31
+ : Description of the ListView Command Set.
32
+
30
33
  `--clientSideComponentProperties [clientSideComponentProperties]`
31
34
  : The Client Side Component properties of the ListView Command Set.
32
35
 
@@ -31,6 +31,9 @@ m365 spo commandset set [options]
31
31
  `--newTitle [newTitle]`
32
32
  : The new title of the ListView Command Set.
33
33
 
34
+ `--description [description]`
35
+ : Description of the ListView Command Set. Specify an empty string to clear.
36
+
34
37
  `-l, --listType [listType]`
35
38
  : The list or library type to register the Command Set on. Allowed values are: `List`, `Library` or `SitePages`.
36
39
 
@@ -0,0 +1,97 @@
1
+ import Global from '/docs/cmd/_global.mdx';
2
+ import Tabs from '@theme/Tabs';
3
+ import TabItem from '@theme/TabItem';
4
+
5
+ # spo site versionpolicy get
6
+
7
+ Retrieves the version policy settings of a specific site.
8
+
9
+ ## Usage
10
+
11
+ ```sh
12
+ m365 spo site versionpolicy get [options]
13
+ ```
14
+
15
+ ## Options
16
+
17
+ ```md definition-list
18
+ `-u, --siteUrl <siteUrl>`
19
+ : URL of the site.
20
+ ```
21
+
22
+ <Global />
23
+
24
+ ## Permissions
25
+
26
+ <Tabs>
27
+ <TabItem value="Delegated">
28
+
29
+ | Resource | Permissions |
30
+ |------------|---------------|
31
+ | SharePoint | AllSites.Read |
32
+
33
+ </TabItem>
34
+ <TabItem value="Application">
35
+
36
+ | Resource | Permissions |
37
+ |------------|----------------|
38
+ | SharePoint | Sites.Read.All |
39
+
40
+ </TabItem>
41
+ </Tabs>
42
+
43
+ ## Examples
44
+
45
+ Retrieve the version policy settings of a specific site.
46
+
47
+ ```sh
48
+ m365 spo site versionpolicy get --siteUrl "https://contoso.sharepoint.com/sites/Marketing"
49
+ ```
50
+
51
+ ## Response
52
+
53
+ <Tabs>
54
+ <TabItem value="JSON">
55
+
56
+ ```json
57
+ {
58
+ "defaultTrimMode": "automatic",
59
+ "defaultExpireAfterDays": 30,
60
+ "majorVersionLimit": 500
61
+ }
62
+ ```
63
+
64
+ </TabItem>
65
+ <TabItem value="Text">
66
+
67
+ ```text
68
+ defaultExpireAfterDays: 30
69
+ defaultTrimMode : automatic
70
+ majorVersionLimit : 500
71
+ ```
72
+
73
+ </TabItem>
74
+ <TabItem value="CSV">
75
+
76
+ ```csv
77
+ defaultTrimMode,defaultExpireAfterDays,majorVersionLimit
78
+ automatic,30,500
79
+ ```
80
+
81
+ </TabItem>
82
+ <TabItem value="Markdown">
83
+
84
+ ```md
85
+ # spo site versionpolicy get --debug "false" --verbose "false" --siteUrl "https://contoso.sharepoint.com/"
86
+
87
+ Date: 8/23/2025
88
+
89
+ Property | Value
90
+ ---------|-------
91
+ defaultTrimMode | automatic
92
+ defaultExpireAfterDays | 30
93
+ majorVersionLimit | 500
94
+ ```
95
+
96
+ </TabItem>
97
+ </Tabs>