@pnp/cli-microsoft365 10.9.0-beta.bc13e90 → 10.10.0-beta.1bb5ba0

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.
Files changed (125) hide show
  1. package/.devcontainer/Dockerfile +1 -1
  2. package/.devproxy/api-specs/sharepoint-admin.yaml +67 -0
  3. package/.devproxy/api-specs/sharepoint.yaml +230 -0
  4. package/.devproxy/devproxyrc.json +48 -0
  5. package/.devproxy/generate-openapi-spec.json +24 -0
  6. package/.devproxy/spo-csom-types.json +54 -0
  7. package/.eslintrc.cjs +8 -0
  8. package/Dockerfile +3 -3
  9. package/allCommands.json +1 -1
  10. package/allCommandsFull.json +1 -1
  11. package/dist/cli/cli.js +2 -2
  12. package/dist/m365/app/commands/permission/permission-add.js +8 -1
  13. package/dist/m365/base/SpoCommand.js +1 -0
  14. package/dist/m365/entra/commands/app/app-permission-add.js +5 -18
  15. package/dist/m365/entra/commands/m365group/m365group-get.js +16 -3
  16. package/dist/m365/entra/commands/m365group/m365group-list.js +7 -1
  17. package/dist/m365/entra/commands/organization/organization-set.js +104 -0
  18. package/dist/m365/entra/commands/pim/pim-role-assignment-eligibility-list.js +9 -3
  19. package/dist/m365/entra/commands/pim/pim-role-assignment-list.js +9 -3
  20. package/dist/m365/entra/commands/pim/pim-role-request-list.js +9 -3
  21. package/dist/m365/entra/commands.js +1 -0
  22. package/dist/m365/file/commands/file-copy.js +2 -2
  23. package/dist/m365/file/commands/file-move.js +1 -1
  24. package/dist/m365/flow/commands/flow-list.js +14 -7
  25. package/dist/m365/flow/commands/run/run-get.js +1 -1
  26. package/dist/m365/graph/commands/subscription/subscription-add.js +10 -3
  27. package/dist/m365/planner/commands/tenant/tenant-settings-list.js +0 -3
  28. package/dist/m365/pp/commands/solution/solution-publisher-list.js +8 -1
  29. package/dist/m365/purview/commands/threatassessment/threatassessment-get.js +9 -2
  30. package/dist/m365/spo/commands/contenttype/contenttype-add.js +3 -65
  31. package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +5 -50
  32. package/dist/m365/spo/commands/contenttype/contenttype-field-set.js +4 -48
  33. package/dist/m365/spo/commands/contenttype/contenttype-set.js +8 -58
  34. package/dist/m365/spo/commands/contenttype/contenttype-sync.js +2 -2
  35. package/dist/m365/spo/commands/file/file-move.js +8 -2
  36. package/dist/m365/spo/commands/folder/folder-sharinglink-add.js +1 -1
  37. package/dist/m365/spo/commands/folder/folder-sharinglink-clear.js +1 -1
  38. package/dist/m365/spo/commands/folder/folder-sharinglink-get.js +1 -1
  39. package/dist/m365/spo/commands/folder/folder-sharinglink-list.js +1 -1
  40. package/dist/m365/spo/commands/folder/folder-sharinglink-remove.js +1 -1
  41. package/dist/m365/spo/commands/folder/folder-sharinglink-set.js +1 -1
  42. package/dist/m365/spo/commands/hubsite/hubsite-get.js +14 -5
  43. package/dist/m365/spo/commands/hubsite/hubsite-list.js +9 -2
  44. package/dist/m365/spo/commands/list/list-view-add.js +140 -87
  45. package/dist/m365/spo/commands/listitem/listitem-batch-set.js +3 -27
  46. package/dist/m365/spo/commands/page/Page.js +16 -1
  47. package/dist/m365/spo/commands/page/clientsidepages.js +53 -17
  48. package/dist/m365/spo/commands/page/page-add.js +1 -1
  49. package/dist/m365/spo/commands/page/page-clientsidewebpart-add.js +2 -8
  50. package/dist/m365/spo/commands/page/page-control-remove.js +99 -0
  51. package/dist/m365/spo/commands/page/page-control-set.js +1 -1
  52. package/dist/m365/spo/commands/page/page-header-set.js +9 -40
  53. package/dist/m365/spo/commands/page/page-publish.js +2 -10
  54. package/dist/m365/spo/commands/page/page-section-add.js +75 -21
  55. package/dist/m365/spo/commands/page/page-set.js +1 -1
  56. package/dist/m365/spo/commands/site/site-admin-add.js +1 -12
  57. package/dist/m365/spo/commands/site/site-set.js +2 -2
  58. package/dist/m365/spo/commands/tenant/tenant-site-list.js +16 -5
  59. package/dist/m365/spo/commands/term/term-list.js +10 -3
  60. package/dist/m365/spo/commands.js +1 -0
  61. package/dist/m365/teams/commands/chat/chat-member-add.js +10 -4
  62. package/dist/m365/viva/commands/engage/engage-community-remove.js +99 -0
  63. package/dist/m365/viva/commands/engage/engage-network-list.js +8 -2
  64. package/dist/m365/viva/commands.js +1 -0
  65. package/dist/utils/entraServicePrincipal.js +21 -0
  66. package/dist/utils/md.js +3 -3
  67. package/dist/utils/spo.js +87 -3
  68. package/docs/docs/cmd/_global.mdx +1 -1
  69. package/docs/docs/cmd/entra/m365group/m365group-get.mdx +8 -5
  70. package/docs/docs/cmd/entra/m365group/m365group-list.mdx +14 -12
  71. package/docs/docs/cmd/entra/organization/organization-set.mdx +84 -0
  72. package/docs/docs/cmd/entra/pim/pim-role-assignment-eligibility-list.mdx +7 -4
  73. package/docs/docs/cmd/entra/pim/pim-role-assignment-list.mdx +9 -6
  74. package/docs/docs/cmd/entra/pim/pim-role-request-list.mdx +7 -4
  75. package/docs/docs/cmd/flow/flow-list.mdx +8 -5
  76. package/docs/docs/cmd/flow/run/run-get.mdx +1 -1
  77. package/docs/docs/cmd/graph/subscription/subscription-add.mdx +6 -3
  78. package/docs/docs/cmd/planner/bucket/bucket-add.mdx +19 -0
  79. package/docs/docs/cmd/planner/bucket/bucket-get.mdx +19 -0
  80. package/docs/docs/cmd/planner/bucket/bucket-list.mdx +19 -0
  81. package/docs/docs/cmd/planner/bucket/bucket-remove.mdx +21 -0
  82. package/docs/docs/cmd/planner/bucket/bucket-set.mdx +21 -0
  83. package/docs/docs/cmd/planner/plan/plan-add.mdx +19 -0
  84. package/docs/docs/cmd/planner/plan/plan-get.mdx +19 -0
  85. package/docs/docs/cmd/planner/plan/plan-list.mdx +19 -0
  86. package/docs/docs/cmd/planner/plan/plan-remove.mdx +21 -0
  87. package/docs/docs/cmd/planner/plan/plan-set.mdx +19 -0
  88. package/docs/docs/cmd/planner/roster/roster-add.mdx +19 -0
  89. package/docs/docs/cmd/planner/roster/roster-get.mdx +19 -0
  90. package/docs/docs/cmd/planner/roster/roster-member-add.mdx +19 -0
  91. package/docs/docs/cmd/planner/roster/roster-member-get.mdx +19 -0
  92. package/docs/docs/cmd/planner/roster/roster-member-list.mdx +19 -0
  93. package/docs/docs/cmd/planner/roster/roster-member-remove.mdx +21 -0
  94. package/docs/docs/cmd/planner/roster/roster-plan-list.mdx +19 -0
  95. package/docs/docs/cmd/planner/roster/roster-remove.mdx +21 -0
  96. package/docs/docs/cmd/planner/task/task-add.mdx +19 -0
  97. package/docs/docs/cmd/planner/task/task-checklistitem-add.mdx +19 -0
  98. package/docs/docs/cmd/planner/task/task-checklistitem-list.mdx +19 -0
  99. package/docs/docs/cmd/planner/task/task-checklistitem-remove.mdx +21 -0
  100. package/docs/docs/cmd/planner/task/task-get.mdx +27 -0
  101. package/docs/docs/cmd/planner/task/task-list.mdx +19 -0
  102. package/docs/docs/cmd/planner/task/task-reference-add.mdx +19 -0
  103. package/docs/docs/cmd/planner/task/task-reference-list.mdx +19 -0
  104. package/docs/docs/cmd/planner/task/task-reference-remove.mdx +21 -0
  105. package/docs/docs/cmd/planner/task/task-remove.mdx +21 -0
  106. package/docs/docs/cmd/planner/task/task-set.mdx +19 -0
  107. package/docs/docs/cmd/planner/tenant/tenant-settings-list.mdx +44 -7
  108. package/docs/docs/cmd/planner/tenant/tenant-settings-set.mdx +43 -8
  109. package/docs/docs/cmd/pp/solution/solution-publisher-list.mdx +7 -4
  110. package/docs/docs/cmd/purview/threatassessment/threatassessment-get.mdx +7 -4
  111. package/docs/docs/cmd/spo/file/file-move.mdx +4 -1
  112. package/docs/docs/cmd/spo/hubsite/hubsite-get.mdx +6 -3
  113. package/docs/docs/cmd/spo/hubsite/hubsite-list.mdx +7 -4
  114. package/docs/docs/cmd/spo/list/list-add.mdx +1 -1
  115. package/docs/docs/cmd/spo/list/list-set.mdx +2 -2
  116. package/docs/docs/cmd/spo/list/list-view-add.mdx +53 -10
  117. package/docs/docs/cmd/spo/page/page-control-remove.mdx +56 -0
  118. package/docs/docs/cmd/spo/page/page-section-add.mdx +22 -2
  119. package/docs/docs/cmd/spo/tenant/tenant-site-list.mdx +10 -7
  120. package/docs/docs/cmd/spo/term/term-list.mdx +7 -4
  121. package/docs/docs/cmd/teams/chat/chat-member-add.mdx +6 -3
  122. package/docs/docs/cmd/viva/engage/engage-community-remove.mdx +61 -0
  123. package/docs/docs/cmd/viva/engage/engage-network-list.mdx +7 -4
  124. package/npm-shrinkwrap.json +2390 -587
  125. package/package.json +20 -17
@@ -6,9 +6,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _SpoPageHeaderSetCommand_instances, _SpoPageHeaderSetCommand_initTelemetry, _SpoPageHeaderSetCommand_initOptions, _SpoPageHeaderSetCommand_initValidators;
7
7
  import request from '../../../../request.js';
8
8
  import { formatting } from '../../../../utils/formatting.js';
9
+ import { spo } from '../../../../utils/spo.js';
9
10
  import { validation } from '../../../../utils/validation.js';
10
11
  import SpoCommand from '../../../base/SpoCommand.js';
11
12
  import commands from '../../commands.js';
13
+ import { Page } from './Page.js';
12
14
  const BannerWebPartId = 'cbe7b0a9-3504-44dd-a3a3-0e5cacd07788';
13
15
  class SpoPageHeaderSetCommand extends SpoCommand {
14
16
  get name() {
@@ -148,14 +150,7 @@ class SpoPageHeaderSetCommand extends SpoCommand {
148
150
  pageData = await request.get(requestOptions);
149
151
  }
150
152
  else {
151
- const requestOptions = {
152
- url: `${args.options.webUrl}/_api/sitepages/pages/GetByUrl('sitepages/${formatting.encodeQueryParameter(pageFullName)}')/checkoutpage`,
153
- headers: {
154
- 'accept': 'application/json;odata=nometadata'
155
- },
156
- responseType: 'json'
157
- };
158
- pageData = await request.post(requestOptions);
153
+ pageData = await Page.checkout(pageFullName, args.options.webUrl, logger, this.verbose);
159
154
  }
160
155
  switch (args.options.type) {
161
156
  case 'None':
@@ -220,23 +215,23 @@ class SpoPageHeaderSetCommand extends SpoCommand {
220
215
  }
221
216
  else {
222
217
  const res = await Promise.all([
223
- this.getSiteId(args.options.webUrl, this.verbose, logger),
224
- this.getWebId(args.options.webUrl, this.verbose, logger),
218
+ spo.getSiteIdBySPApi(args.options.webUrl, logger, this.verbose),
219
+ spo.getWebId(args.options.webUrl, logger, this.verbose),
225
220
  this.getImageInfo(args.options.webUrl, args.options.imageUrl, this.verbose, logger)
226
221
  ]);
227
222
  header.serverProcessedContent.customMetadata = {
228
223
  imageSource: {
229
- siteId: res[0].Id,
230
- webId: res[1].Id,
224
+ siteId: res[0],
225
+ webId: res[1],
231
226
  listId: res[2].ListId,
232
227
  uniqueId: res[2].UniqueId
233
228
  }
234
229
  };
235
230
  const properties = header.properties;
236
231
  properties.listId = res[2].ListId;
237
- properties.siteId = res[0].Id;
232
+ properties.siteId = res[0];
238
233
  properties.uniqueId = res[2].UniqueId;
239
- properties.webId = res[1].Id;
234
+ properties.webId = res[1];
240
235
  header.properties = properties;
241
236
  }
242
237
  }
@@ -306,32 +301,6 @@ class SpoPageHeaderSetCommand extends SpoCommand {
306
301
  this.handleRejectedODataJsonPromise(err);
307
302
  }
308
303
  }
309
- async getSiteId(siteUrl, verbose, logger) {
310
- if (verbose) {
311
- await logger.logToStderr(`Retrieving information about the site collection...`);
312
- }
313
- const requestOptions = {
314
- url: `${siteUrl}/_api/site?$select=Id`,
315
- headers: {
316
- accept: 'application/json;odata=nometadata'
317
- },
318
- responseType: 'json'
319
- };
320
- return request.get(requestOptions);
321
- }
322
- async getWebId(siteUrl, verbose, logger) {
323
- if (verbose) {
324
- await logger.logToStderr(`Retrieving information about the site...`);
325
- }
326
- const requestOptions = {
327
- url: `${siteUrl}/_api/web?$select=Id`,
328
- headers: {
329
- accept: 'application/json;odata=nometadata'
330
- },
331
- responseType: 'json'
332
- };
333
- return request.get(requestOptions);
334
- }
335
304
  async getImageInfo(siteUrl, imageUrl, verbose, logger) {
336
305
  if (verbose) {
337
306
  await logger.logToStderr(`Retrieving information about the header image...`);
@@ -1,12 +1,11 @@
1
1
  import { z } from 'zod';
2
2
  import { zod } from '../../../../utils/zod.js';
3
3
  import { globalOptionsZod } from '../../../../Command.js';
4
- import request from '../../../../request.js';
5
- import { formatting } from '../../../../utils/formatting.js';
6
4
  import { urlUtil } from '../../../../utils/urlUtil.js';
7
5
  import { validation } from '../../../../utils/validation.js';
8
6
  import SpoCommand from '../../../base/SpoCommand.js';
9
7
  import commands from '../../commands.js';
8
+ import { Page } from './Page.js';
10
9
  const options = globalOptionsZod
11
10
  .extend({
12
11
  webUrl: zod.alias('u', z.string()
@@ -36,14 +35,7 @@ class SpoPagePublishCommand extends SpoCommand {
36
35
  if (this.verbose) {
37
36
  await logger.logToStderr(`Publishing page ${pageName}...`);
38
37
  }
39
- const filePath = `${urlUtil.getServerRelativeSiteUrl(args.options.webUrl)}/SitePages/${pageName}`;
40
- const requestOptions = {
41
- url: `${args.options.webUrl}/_api/web/GetFileByServerRelativePath(DecodedUrl='${formatting.encodeQueryParameter(filePath)}')/Publish()`,
42
- headers: {
43
- accept: 'application/json;odata=nometadata'
44
- }
45
- };
46
- await request.post(requestOptions);
38
+ await Page.publishPage(args.options.webUrl, pageName);
47
39
  }
48
40
  catch (err) {
49
41
  this.handleRejectedODataJsonPromise(err);
@@ -11,6 +11,7 @@ import { validation } from '../../../../utils/validation.js';
11
11
  import SpoCommand from '../../../base/SpoCommand.js';
12
12
  import commands from '../../commands.js';
13
13
  import { CanvasSectionTemplate } from './clientsidepages.js';
14
+ import { Page } from './Page.js';
14
15
  class SpoPageSectionAddCommand extends SpoCommand {
15
16
  get name() {
16
17
  return commands.PAGE_SECTION_ADD;
@@ -21,10 +22,12 @@ class SpoPageSectionAddCommand extends SpoCommand {
21
22
  constructor() {
22
23
  super();
23
24
  _SpoPageSectionAddCommand_instances.add(this);
24
- this.sectionTemplate = ['OneColumn', 'OneColumnFullWidth', 'TwoColumn', 'ThreeColumn', 'TwoColumnLeft', 'TwoColumnRight', 'Vertical'];
25
+ this.sectionTemplate = ['OneColumn', 'OneColumnFullWidth', 'TwoColumn', 'ThreeColumn', 'TwoColumnLeft', 'TwoColumnRight', 'Vertical', 'Flexible'];
25
26
  this.zoneEmphasis = ['None', 'Neutral', 'Soft', 'Strong', 'Image', 'Gradient'];
26
27
  this.iconAlignment = ['Left', 'Right'];
27
28
  this.fillMode = ['ScaleToFill', 'ScaleToFit', 'Tile', 'OriginalSize'];
29
+ this.zoneReflowStrategy = ['TopToBottom', 'LeftToRight'];
30
+ this.MINIMUM_ZONE_HEIGHT = 34;
28
31
  __classPrivateFieldGet(this, _SpoPageSectionAddCommand_instances, "m", _SpoPageSectionAddCommand_initTelemetry).call(this);
29
32
  __classPrivateFieldGet(this, _SpoPageSectionAddCommand_instances, "m", _SpoPageSectionAddCommand_initOptions).call(this);
30
33
  __classPrivateFieldGet(this, _SpoPageSectionAddCommand_instances, "m", _SpoPageSectionAddCommand_initValidators).call(this);
@@ -49,15 +52,14 @@ class SpoPageSectionAddCommand extends SpoCommand {
49
52
  };
50
53
  const res = await request.get(requestOptions);
51
54
  canvasContent = JSON.parse(res.CanvasContent1 || "[{\"controlType\":0,\"pageSettingsSlice\":{\"isDefaultDescription\":true,\"isDefaultThumbnail\":true}}]");
55
+ if (args.options.sectionTemplate === 'OneColumnFullWidth') {
56
+ this.ensureFullWidthSectionCanBeAdded(canvasContent);
57
+ }
58
+ if (args.options.sectionTemplate === 'Vertical') {
59
+ this.ensureVerticalSectionCanBeAdded(canvasContent);
60
+ }
52
61
  if (!res.IsPageCheckedOutToCurrentUser) {
53
- requestOptions = {
54
- url: `${args.options.webUrl}/_api/sitepages/pages/GetByUrl('sitepages/${formatting.encodeQueryParameter(pageFullName)}')/checkoutpage`,
55
- headers: {
56
- 'accept': 'application/json;odata=nometadata'
57
- },
58
- responseType: 'json'
59
- };
60
- await request.post(requestOptions);
62
+ await Page.checkout(pageFullName, args.options.webUrl, logger, this.verbose);
61
63
  }
62
64
  // get unique zoneIndex values given each section can have 1 or more
63
65
  // columns each assigned to the zoneIndex of the corresponding section
@@ -148,6 +150,9 @@ class SpoPageSectionAddCommand extends SpoCommand {
148
150
  case 'Vertical':
149
151
  columns.push(this.getVerticalColumn(args, zoneId));
150
152
  break;
153
+ case 'Flexible':
154
+ columns.push(this.getFlexibleColumn(zoneIndex, sectionIndex++, args, zoneId));
155
+ break;
151
156
  case 'OneColumn':
152
157
  default:
153
158
  columns.push(this.getColumn(zoneIndex, sectionIndex++, 12, args, zoneId));
@@ -168,9 +173,9 @@ class SpoPageSectionAddCommand extends SpoCommand {
168
173
  },
169
174
  emphasis: {}
170
175
  };
171
- if (zoneEmphasis && ['none', 'neutral', 'soft', 'strong'].includes(zoneEmphasis?.toLocaleLowerCase())) {
176
+ if (zoneEmphasis && ['none', 'neutral', 'soft', 'strong'].includes(zoneEmphasis?.toLowerCase())) {
172
177
  // Just these zoneEmphasis values should be added to column emphasis
173
- const zoneEmphasisValue = ['none', 'neutral', 'soft', 'strong'].indexOf(zoneEmphasis.toLocaleLowerCase());
178
+ const zoneEmphasisValue = ['none', 'neutral', 'soft', 'strong'].indexOf(zoneEmphasis.toLowerCase());
174
179
  columnValue.emphasis = { zoneEmphasis: zoneEmphasisValue };
175
180
  }
176
181
  if (isCollapsibleSection) {
@@ -178,8 +183,9 @@ class SpoPageSectionAddCommand extends SpoCommand {
178
183
  type: 1,
179
184
  isExpanded: !!isExpanded,
180
185
  showDividerLine: !!showDivider,
181
- iconAlignment: iconAlignment && iconAlignment.toLocaleLowerCase() === "right" ? "right" : "left",
182
- displayName: collapsibleTitle
186
+ iconAlignment: iconAlignment && iconAlignment.toLowerCase() === "right" ? "right" : "left",
187
+ displayName: collapsibleTitle,
188
+ headingLevel: args.options.headingLevel ? args.options.headingLevel : 2 //2 is a default heading level
183
189
  };
184
190
  }
185
191
  return columnValue;
@@ -191,6 +197,14 @@ class SpoPageSectionAddCommand extends SpoCommand {
191
197
  columnValue.position.controlIndex = 1;
192
198
  return columnValue;
193
199
  }
200
+ getFlexibleColumn(zoneIndex, sectionIndex, args, zoneId) {
201
+ const columnValue = this.getColumn(zoneIndex, sectionIndex, 100, args, zoneId);
202
+ columnValue.zoneReflowStrategy = { axis: args.options.zoneReflowStrategy ? this.zoneReflowStrategy.indexOf(args.options.zoneReflowStrategy) : 0 };
203
+ if (args.options.zoneHeight) {
204
+ columnValue.zoneHeight = args.options.zoneHeight;
205
+ }
206
+ return columnValue;
207
+ }
194
208
  setBackgroundControl(zoneId, backgroundControl, args) {
195
209
  const { overlayColor, overlayOpacity, useLightText, imageUrl } = args.options;
196
210
  const backgroundDetails = this.getBackgroundDetails(args);
@@ -243,6 +257,18 @@ class SpoPageSectionAddCommand extends SpoCommand {
243
257
  }
244
258
  return backgroundDetails;
245
259
  }
260
+ ensureFullWidthSectionCanBeAdded(canvasContent) {
261
+ const hasVerticalSection = canvasContent.some((c) => c.position?.layoutIndex === 2 && c.position.sectionFactor === 12);
262
+ if (hasVerticalSection) {
263
+ throw "A vertical section already exists on the page. A full-width section cannot be added to a page that already has a vertical section.";
264
+ }
265
+ }
266
+ ensureVerticalSectionCanBeAdded(canvasContent) {
267
+ const hasFullWidthSection = canvasContent.some((c) => c.position?.layoutIndex === 1 && c.position.sectionFactor === 0);
268
+ if (hasFullWidthSection) {
269
+ throw "A full-width section already exists on the page. A vertical section cannot be added to a page that already has a full-width section.";
270
+ }
271
+ }
246
272
  }
247
273
  _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_initTelemetry = function _SpoPageSectionAddCommand_initTelemetry() {
248
274
  this.telemetry.push((args) => {
@@ -262,7 +288,10 @@ _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_i
262
288
  useLightText: !!args.options.useLightText,
263
289
  overlayColor: typeof args.options.overlayColor !== 'undefined',
264
290
  overlayOpacity: typeof args.options.overlayOpacity !== 'undefined',
265
- collapsibleTitle: typeof args.options.collapsibleTitle !== 'undefined'
291
+ collapsibleTitle: typeof args.options.collapsibleTitle !== 'undefined',
292
+ zoneReflowStrategy: typeof args.options.zoneReflowStrategy !== 'undefined',
293
+ zoneHeight: typeof args.options.zoneHeight !== 'undefined',
294
+ headingLevel: typeof args.options.headingLevel !== 'undefined'
266
295
  });
267
296
  });
268
297
  }, _SpoPageSectionAddCommand_initOptions = function _SpoPageSectionAddCommand_initOptions() {
@@ -308,11 +337,18 @@ _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_i
308
337
  option: '--overlayOpacity [overlayOpacity]'
309
338
  }, {
310
339
  option: '--collapsibleTitle [collapsibleTitle]'
340
+ }, {
341
+ option: '--zoneReflowStrategy [zoneReflowStrategy]',
342
+ autocomplete: this.zoneReflowStrategy
343
+ }, {
344
+ option: '--zoneHeight [zoneHeight]'
345
+ }, {
346
+ option: '--headingLevel [headingLevel]'
311
347
  });
312
348
  }, _SpoPageSectionAddCommand_initValidators = function _SpoPageSectionAddCommand_initValidators() {
313
349
  this.validators.push(async (args) => {
314
350
  if (!(args.options.sectionTemplate in CanvasSectionTemplate)) {
315
- return `${args.options.sectionTemplate} is not a valid section template. Allowed values are OneColumn|OneColumnFullWidth|TwoColumn|ThreeColumn|TwoColumnLeft|TwoColumnRight|Vertical`;
351
+ return `${args.options.sectionTemplate} is not a valid section template. Allowed values are OneColumn|OneColumnFullWidth|TwoColumn|ThreeColumn|TwoColumnLeft|TwoColumnRight|Vertical|Flexible`;
316
352
  }
317
353
  if (typeof args.options.order !== 'undefined') {
318
354
  if (!Number.isInteger(args.options.order) || args.options.order < 1) {
@@ -320,7 +356,7 @@ _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_i
320
356
  }
321
357
  }
322
358
  if (typeof args.options.zoneEmphasis !== 'undefined') {
323
- if (!this.zoneEmphasis.some(zoneEmphasisValue => zoneEmphasisValue.toLocaleLowerCase() === args.options.zoneEmphasis?.toLowerCase())) {
359
+ if (!this.zoneEmphasis.some(zoneEmphasisValue => zoneEmphasisValue.toLowerCase() === args.options.zoneEmphasis?.toLowerCase())) {
324
360
  return `The value of parameter zoneEmphasis must be ${this.zoneEmphasis.join(', ')}`;
325
361
  }
326
362
  }
@@ -330,20 +366,30 @@ _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_i
330
366
  }
331
367
  }
332
368
  if (typeof args.options.iconAlignment !== 'undefined') {
333
- if (!this.iconAlignment.some(iconAlignmentValue => iconAlignmentValue.toLocaleLowerCase() === args.options.iconAlignment?.toLowerCase())) {
369
+ if (!this.iconAlignment.some(iconAlignmentValue => iconAlignmentValue.toLowerCase() === args.options.iconAlignment?.toLowerCase())) {
334
370
  return `The value of parameter iconAlignment must be ${this.iconAlignment.join(', ')}`;
335
371
  }
336
372
  }
337
373
  if (typeof args.options.fillMode !== 'undefined') {
338
- if (!this.fillMode.some(fillModeValue => fillModeValue.toLocaleLowerCase() === args.options.fillMode?.toLowerCase())) {
374
+ if (!this.fillMode.some(fillModeValue => fillModeValue.toLowerCase() === args.options.fillMode?.toLowerCase())) {
339
375
  return `The value of parameter fillMode must be ${this.fillMode.join(', ')}`;
340
376
  }
341
377
  }
342
- if (args.options.zoneEmphasis?.toLocaleLowerCase() !== 'image' && (args.options.imageUrl || args.options.imageWidth ||
378
+ if (typeof args.options.zoneReflowStrategy !== 'undefined') {
379
+ if (!this.zoneReflowStrategy.some(zoneReflowStrategyValue => zoneReflowStrategyValue.toLowerCase() === args.options.zoneReflowStrategy?.toLowerCase())) {
380
+ return `The value of parameter zoneReflowStrategy must be ${this.zoneReflowStrategy.join(', ')}`;
381
+ }
382
+ }
383
+ if (typeof args.options.headingLevel !== 'undefined') {
384
+ if (![2, 3, 4].some(headingLevelValue => headingLevelValue === args.options.headingLevel)) {
385
+ return `The value of parameter headingLevel must be 2, 3 or 4`;
386
+ }
387
+ }
388
+ if (args.options.zoneEmphasis?.toLowerCase() !== 'image' && (args.options.imageUrl || args.options.imageWidth ||
343
389
  args.options.imageHeight || args.options.fillMode)) {
344
390
  return 'Specify imageUrl, imageWidth, imageHeight or fillMode only when zoneEmphasis is set to Image';
345
391
  }
346
- if (args.options.zoneEmphasis?.toLocaleLowerCase() === 'image' && !args.options.imageUrl) {
392
+ if (args.options.zoneEmphasis?.toLowerCase() === 'image' && !args.options.imageUrl) {
347
393
  return 'Specify imageUrl when zoneEmphasis is set to Image';
348
394
  }
349
395
  if (args.options.zoneEmphasis?.toLowerCase() !== 'gradient' && args.options.gradientText) {
@@ -361,10 +407,18 @@ _SpoPageSectionAddCommand_instances = new WeakSet(), _SpoPageSectionAddCommand_i
361
407
  if (!(args.options.zoneEmphasis && ['image', 'gradient'].includes(args.options.zoneEmphasis.toLowerCase())) && (args.options.overlayColor || args.options.overlayOpacity || args.options.useLightText)) {
362
408
  return 'Specify overlayColor or overlayOpacity only when zoneEmphasis is set to Image or Gradient';
363
409
  }
410
+ if (args.options.sectionTemplate?.toLowerCase() !== 'flexible' && (args.options.zoneReflowStrategy || args.options.zoneHeight)) {
411
+ return 'Specify zoneReflowStrategy or zoneHeight only when sectionTemplate is set to Flexible';
412
+ }
413
+ if (typeof args.options.zoneHeight !== 'undefined') {
414
+ if (!Number.isInteger(args.options.zoneHeight) || args.options.zoneHeight < this.MINIMUM_ZONE_HEIGHT) {
415
+ return `The value of parameter zoneHeight must be ${this.MINIMUM_ZONE_HEIGHT} or higher`;
416
+ }
417
+ }
364
418
  return validation.isValidSharePointUrl(args.options.webUrl);
365
419
  });
366
420
  }, _SpoPageSectionAddCommand_initTypes = function _SpoPageSectionAddCommand_initTypes() {
367
- this.types.string = ['pageName', 'webUrl', 'sectionTemplate', 'zoneEmphasis', 'iconAlignment', 'gradientText', 'imageUrl', 'fillMode', 'overlayColor', 'collapsibleTitle'];
421
+ this.types.string = ['pageName', 'webUrl', 'sectionTemplate', 'zoneEmphasis', 'iconAlignment', 'gradientText', 'imageUrl', 'fillMode', 'overlayColor', 'collapsibleTitle', 'zoneReflowStrategy'];
368
422
  this.types.boolean = ['isLayoutReflowOnTop', 'isCollapsibleSection', 'showDivider', 'isExpanded', 'useLightText'];
369
423
  };
370
424
  export default new SpoPageSectionAddCommand();
@@ -52,7 +52,7 @@ class SpoPageSetCommand extends SpoCommand {
52
52
  try {
53
53
  const requestDigestResult = await spo.getRequestDigest(args.options.webUrl);
54
54
  const requestDigest = requestDigestResult.FormDigestValue;
55
- const page = await Page.checkout(args.options.name, args.options.webUrl, logger, this.debug, this.verbose);
55
+ const page = await Page.checkout(args.options.name, args.options.webUrl, logger, this.verbose);
56
56
  if (page) {
57
57
  pageTitle = pageTitle || page.Title;
58
58
  pageId = page.Id;
@@ -125,7 +125,7 @@ class SpoSiteAdminAddCommand extends SpoCommand {
125
125
  const ensuredUserData = await this.ensureUser(args, loginNameToAdd);
126
126
  await this.setSiteAdmin(args.options.siteUrl, loginNameToAdd);
127
127
  if (args.options.primary) {
128
- const siteId = await this.getSiteId(args.options.siteUrl);
128
+ const siteId = await spo.getSiteIdBySPApi(args.options.siteUrl, logger, this.verbose);
129
129
  const previousPrimaryOwner = await this.getSiteOwnerLoginName(args.options.siteUrl);
130
130
  await this.setPrimaryOwnerLoginFromSite(logger, args.options.siteUrl, siteId, ensuredUserData);
131
131
  await this.setSiteAdmin(args.options.siteUrl, previousPrimaryOwner);
@@ -157,17 +157,6 @@ class SpoSiteAdminAddCommand extends SpoCommand {
157
157
  };
158
158
  return request.post(requestOptions);
159
159
  }
160
- async getSiteId(siteUrl) {
161
- const requestOptions = {
162
- url: `${siteUrl}/_api/site?$select=Id`,
163
- headers: {
164
- accept: 'application/json;odata=nometadata'
165
- },
166
- responseType: 'json'
167
- };
168
- const response = await request.get(requestOptions);
169
- return response.Id;
170
- }
171
160
  async getSiteOwnerLoginName(siteUrl) {
172
161
  const requestOptions = {
173
162
  url: `${siteUrl}/_api/site/owner?$select=LoginName`,
@@ -62,7 +62,7 @@ class SpoSiteSetCommand extends SpoCommand {
62
62
  if (this.debug) {
63
63
  await logger.logToStderr(`Setting the site its logo...`);
64
64
  }
65
- const logoUrl = args.options.siteLogoUrl ? urlUtil.getServerRelativePath(args.options.url, args.options.siteLogoUrl) : "";
65
+ const logoUrl = args.options.siteLogoUrl ? urlUtil.getUrlRelativePath(args.options.siteLogoUrl) : "";
66
66
  const requestOptions = {
67
67
  url: `${args.options.url}/_api/siteiconmanager/setsitelogo`,
68
68
  headers: {
@@ -84,7 +84,7 @@ class SpoSiteSetCommand extends SpoCommand {
84
84
  if (this.debug) {
85
85
  await logger.logToStderr(`Setting the site thumbnail...`);
86
86
  }
87
- const thumbnailUrl = args.options.siteThumbnailUrl ? urlUtil.getServerRelativePath(args.options.url, args.options.siteThumbnailUrl) : "";
87
+ const thumbnailUrl = args.options.siteThumbnailUrl ? urlUtil.getUrlRelativePath(args.options.siteThumbnailUrl) : "";
88
88
  const requestOptions = {
89
89
  url: `${args.options.url}/_api/siteiconmanager/setsitelogo`,
90
90
  headers: {
@@ -31,8 +31,11 @@ class SpoTenantSiteListCommand extends SpoCommand {
31
31
  return [commands.SITE_LIST];
32
32
  }
33
33
  async commandAction(logger, args) {
34
+ if (args.options.includeOneDriveSites) {
35
+ await this.warn(logger, `Parameter 'includeOneDriveSites' is deprecated. Please use 'withOneDriveSites' instead`);
36
+ }
34
37
  const webTemplate = this.getWebTemplateId(args.options);
35
- const includeOneDriveSites = args.options.includeOneDriveSites || false;
38
+ const includeOneDriveSites = (args.options.includeOneDriveSites || args.options.withOneDriveSites) || false;
36
39
  const personalSite = includeOneDriveSites === false ? '0' : '1';
37
40
  try {
38
41
  const spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
@@ -76,7 +79,7 @@ class SpoTenantSiteListCommand extends SpoCommand {
76
79
  if (options.webTemplate) {
77
80
  return options.webTemplate;
78
81
  }
79
- if (options.includeOneDriveSites) {
82
+ if (options.includeOneDriveSites || options.withOneDriveSites) {
80
83
  return '';
81
84
  }
82
85
  switch (options.type) {
@@ -95,7 +98,8 @@ _SpoTenantSiteListCommand_instances = new WeakSet(), _SpoTenantSiteListCommand_i
95
98
  webTemplate: args.options.webTemplate,
96
99
  type: args.options.type,
97
100
  filter: (!(!args.options.filter)).toString(),
98
- includeOneDriveSites: typeof args.options.includeOneDriveSites !== 'undefined'
101
+ includeOneDriveSites: typeof args.options.includeOneDriveSites !== 'undefined',
102
+ withOneDriveSites: typeof args.options.withOneDriveSites !== 'undefined'
99
103
  });
100
104
  });
101
105
  }, _SpoTenantSiteListCommand_initOptions = function _SpoTenantSiteListCommand_initOptions() {
@@ -108,6 +112,8 @@ _SpoTenantSiteListCommand_instances = new WeakSet(), _SpoTenantSiteListCommand_i
108
112
  option: '--filter [filter]'
109
113
  }, {
110
114
  option: '--includeOneDriveSites'
115
+ }, {
116
+ option: '--withOneDriveSites'
111
117
  });
112
118
  }, _SpoTenantSiteListCommand_initValidators = function _SpoTenantSiteListCommand_initValidators() {
113
119
  this.validators.push(async (args) => {
@@ -119,9 +125,14 @@ _SpoTenantSiteListCommand_instances = new WeakSet(), _SpoTenantSiteListCommand_i
119
125
  typeValues.indexOf(args.options.type) < 0) {
120
126
  return `${args.options.type} is not a valid value for the type option. Allowed values are ${typeValues.join('|')}`;
121
127
  }
122
- if (args.options.includeOneDriveSites
128
+ if (args.options.includeOneDriveSites || args.options.withOneDriveSites
123
129
  && (args.options.type || args.options.webTemplate)) {
124
- return 'When using includeOneDriveSites, don\'t specify the type or webTemplate options';
130
+ if (args.options.includeOneDriveSites) {
131
+ return 'When using includeOneDriveSites, don\'t specify the type or webTemplate options';
132
+ }
133
+ else {
134
+ return 'When using withOneDriveSites, don\'t specify the type or webTemplate options';
135
+ }
125
136
  }
126
137
  return true;
127
138
  });
@@ -31,6 +31,9 @@ class SpoTermListCommand extends SpoCommand {
31
31
  __classPrivateFieldGet(this, _SpoTermListCommand_instances, "m", _SpoTermListCommand_initOptionSets).call(this);
32
32
  }
33
33
  async commandAction(logger, args) {
34
+ if (args.options.includeChildTerms) {
35
+ await this.warn(logger, `Parameter 'includeChildTerms' is deprecated. Please use 'withChildTerms' instead`);
36
+ }
34
37
  try {
35
38
  const spoWebUrl = args.options.webUrl ? args.options.webUrl : await spo.getSpoAdminUrl(logger, this.debug);
36
39
  const res = await spo.getRequestDigest(spoWebUrl);
@@ -40,13 +43,14 @@ class SpoTermListCommand extends SpoCommand {
40
43
  const termGroupQuery = args.options.termGroupId ? `<Method Id="77" ParentId="75" Name="GetById"><Parameters><Parameter Type="Guid">{${args.options.termGroupId}}</Parameter></Parameters></Method>` : `<Method Id="77" ParentId="75" Name="GetByName"><Parameters><Parameter Type="String">${formatting.escapeXml(args.options.termGroupName)}</Parameter></Parameters></Method>`;
41
44
  const termSetQuery = args.options.termSetId ? `<Method Id="82" ParentId="80" Name="GetById"><Parameters><Parameter Type="Guid">{${args.options.termSetId}}</Parameter></Parameters></Method>` : `<Method Id="82" ParentId="80" Name="GetByName"><Parameters><Parameter Type="String">${formatting.escapeXml(args.options.termSetName)}</Parameter></Parameters></Method>`;
42
45
  const data = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="70" ObjectPathId="69" /><ObjectIdentityQuery Id="71" ObjectPathId="69" /><ObjectPath Id="73" ObjectPathId="72" /><ObjectIdentityQuery Id="74" ObjectPathId="72" /><ObjectPath Id="76" ObjectPathId="75" /><ObjectPath Id="78" ObjectPathId="77" /><ObjectIdentityQuery Id="79" ObjectPathId="77" /><ObjectPath Id="81" ObjectPathId="80" /><ObjectPath Id="83" ObjectPathId="82" /><ObjectIdentityQuery Id="84" ObjectPathId="82" /><ObjectPath Id="86" ObjectPathId="85" /><Query Id="87" ObjectPathId="85"><Query SelectAllProperties="false"><Properties /></Query><ChildItemQuery SelectAllProperties="true"><Properties><Property Name="Name" ScalarProperty="true" /><Property Name="Id" ScalarProperty="true" /></Properties></ChildItemQuery></Query></Actions><ObjectPaths><StaticMethod Id="69" Name="GetTaxonomySession" TypeId="{981cbc68-9edc-4f8d-872f-71146fcbb84f}" /><Method Id="72" ParentId="69" Name="GetDefaultSiteCollectionTermStore" /><Property Id="75" ParentId="72" Name="Groups" />${termGroupQuery}<Property Id="80" ParentId="77" Name="TermSets" />${termSetQuery}<Property Id="85" ParentId="82" Name="Terms" /></ObjectPaths></Request>`;
46
+ const shouldIncludeChildTerms = args.options.includeChildTerms || args.options.withChildTerms;
43
47
  const result = await this.executeCsomCall(data, spoWebUrl, res);
44
48
  const terms = [];
45
49
  if (result._Child_Items_ && result._Child_Items_.length > 0) {
46
50
  for (const term of result._Child_Items_) {
47
51
  this.setTermDetails(term);
48
52
  terms.push(term);
49
- if (args.options.includeChildTerms && term.TermsCount > 0) {
53
+ if (shouldIncludeChildTerms && term.TermsCount > 0) {
50
54
  await this.getChildTerms(spoWebUrl, res, term);
51
55
  }
52
56
  }
@@ -54,7 +58,7 @@ class SpoTermListCommand extends SpoCommand {
54
58
  if (!args.options.output || !cli.shouldTrimOutput(args.options.output)) {
55
59
  await logger.log(terms);
56
60
  }
57
- else if (!args.options.includeChildTerms) {
61
+ else if (!shouldIncludeChildTerms) {
58
62
  // Converted to text friendly output
59
63
  await logger.log(terms.map(i => {
60
64
  return {
@@ -142,7 +146,8 @@ _SpoTermListCommand_instances = new WeakSet(), _SpoTermListCommand_initTelemetry
142
146
  termGroupName: typeof args.options.termGroupName !== 'undefined',
143
147
  termSetId: typeof args.options.termSetId !== 'undefined',
144
148
  termSetName: typeof args.options.termSetName !== 'undefined',
145
- includeChildTerms: !!args.options.includeChildTerms
149
+ includeChildTerms: !!args.options.includeChildTerms,
150
+ withChildTerms: !!args.options.withChildTerms
146
151
  });
147
152
  });
148
153
  }, _SpoTermListCommand_initOptions = function _SpoTermListCommand_initOptions() {
@@ -158,6 +163,8 @@ _SpoTermListCommand_instances = new WeakSet(), _SpoTermListCommand_initTelemetry
158
163
  option: '--termSetName [termSetName]'
159
164
  }, {
160
165
  option: '--includeChildTerms'
166
+ }, {
167
+ option: '--withChildTerms'
161
168
  });
162
169
  }, _SpoTermListCommand_initValidators = function _SpoTermListCommand_initValidators() {
163
170
  this.validators.push(async (args) => {
@@ -217,6 +217,7 @@ export default {
217
217
  PAGE_COLUMN_LIST: `${prefix} page column list`,
218
218
  PAGE_CONTROL_GET: `${prefix} page control get`,
219
219
  PAGE_CONTROL_LIST: `${prefix} page control list`,
220
+ PAGE_CONTROL_REMOVE: `${prefix} page control remove`,
220
221
  PAGE_CONTROL_SET: `${prefix} page control set`,
221
222
  PAGE_HEADER_SET: `${prefix} page header set`,
222
223
  PAGE_SECTION_ADD: `${prefix} page section add`,
@@ -29,6 +29,9 @@ class TeamsChatMemberAddCommand extends GraphCommand {
29
29
  if (this.verbose) {
30
30
  await logger.logToStderr(`Adding member ${args.options.userId || args.options.userName} to chat with id ${args.options.chatId}...`);
31
31
  }
32
+ if (args.options.includeAllHistory) {
33
+ await this.warn(logger, `Parameter 'includeAllHistory' is deprecated. Please use 'withAllHistory' instead`);
34
+ }
32
35
  const chatMemberAddOptions = {
33
36
  url: `${this.resource}/v1.0/chats/${args.options.chatId}/members`,
34
37
  headers: {
@@ -38,7 +41,7 @@ class TeamsChatMemberAddCommand extends GraphCommand {
38
41
  data: {
39
42
  '@odata.type': '#microsoft.graph.aadUserConversationMember',
40
43
  'user@odata.bind': `https://graph.microsoft.com/v1.0/users/${args.options.userId || formatting.encodeQueryParameter(args.options.userName)}`,
41
- visibleHistoryStartDateTime: args.options.includeAllHistory ? '0001-01-01T00:00:00Z' : args.options.visibleHistoryStartDateTime,
44
+ visibleHistoryStartDateTime: (args.options.includeAllHistory || args.options.withAllHistory) ? '0001-01-01T00:00:00Z' : args.options.visibleHistoryStartDateTime,
42
45
  roles: [args.options.role || 'owner']
43
46
  }
44
47
  };
@@ -56,7 +59,8 @@ _a = TeamsChatMemberAddCommand, _TeamsChatMemberAddCommand_instances = new WeakS
56
59
  userName: typeof args.options.userName !== 'undefined',
57
60
  role: typeof args.options.role !== 'undefined',
58
61
  visibleHistoryStartDateTime: typeof args.options.visibleHistoryStartDateTime !== 'undefined',
59
- includeAllHistory: !!args.options.includeAllHistory
62
+ includeAllHistory: !!args.options.includeAllHistory,
63
+ withAllHistory: !!args.options.withAllHistory
60
64
  });
61
65
  });
62
66
  }, _TeamsChatMemberAddCommand_initOptions = function _TeamsChatMemberAddCommand_initOptions() {
@@ -73,6 +77,8 @@ _a = TeamsChatMemberAddCommand, _TeamsChatMemberAddCommand_instances = new WeakS
73
77
  option: '--visibleHistoryStartDateTime [visibleHistoryStartDateTime]'
74
78
  }, {
75
79
  option: '--includeAllHistory'
80
+ }, {
81
+ option: '--withAllHistory'
76
82
  });
77
83
  }, _TeamsChatMemberAddCommand_initValidators = function _TeamsChatMemberAddCommand_initValidators() {
78
84
  this.validators.push(async (args) => {
@@ -95,8 +101,8 @@ _a = TeamsChatMemberAddCommand, _TeamsChatMemberAddCommand_instances = new WeakS
95
101
  });
96
102
  }, _TeamsChatMemberAddCommand_initOptionSets = function _TeamsChatMemberAddCommand_initOptionSets() {
97
103
  this.optionSets.push({ options: ['userId', 'userName'] }, {
98
- options: ['visibleHistoryStartDateTime', 'includeAllHistory'],
99
- runsWhen: (args) => args.options.visibleHistoryStartDateTime || args.options.includeAllHistory
104
+ options: ['visibleHistoryStartDateTime', 'includeAllHistory', 'withAllHistory'],
105
+ runsWhen: (args) => args.options.visibleHistoryStartDateTime || args.options.includeAllHistory || args.options.withAllHistory
100
106
  });
101
107
  };
102
108
  TeamsChatMemberAddCommand.roles = ['owner', 'guest'];