@pnp/cli-microsoft365 5.0.0-beta.431ccea → 5.0.0-beta.563b474

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,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fs = require("fs");
3
4
  const uuid_1 = require("uuid");
4
5
  const Auth_1 = require("../../../../Auth");
5
6
  const request_1 = require("../../../../request");
@@ -7,6 +8,10 @@ const Utils_1 = require("../../../../Utils");
7
8
  const GraphItemsListCommand_1 = require("../../../base/GraphItemsListCommand");
8
9
  const commands_1 = require("../../commands");
9
10
  class AadAppAddCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.appName = '';
14
+ }
10
15
  get name() {
11
16
  return commands_1.default.APP_ADD;
12
17
  }
@@ -32,18 +37,23 @@ class AadAppAddCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
32
37
  this
33
38
  .resolveApis(args, logger)
34
39
  .then(apis => this.createAppRegistration(args, apis, logger))
40
+ .then(appInfo => {
41
+ // based on the assumption that we're adding AAD app to the current
42
+ // directory. If we in the future extend the command with allowing
43
+ // users to create AAD app in a different directory, we'll need to
44
+ // adjust this
45
+ appInfo.tenantId = Utils_1.default.getTenantIdFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken);
46
+ return Promise.resolve(appInfo);
47
+ })
35
48
  .then(appInfo => this.updateAppFromManifest(args, appInfo))
36
49
  .then(appInfo => this.configureUri(args, appInfo, logger))
37
50
  .then(appInfo => this.configureSecret(args, appInfo, logger))
51
+ .then(appInfo => this.saveAppInfo(args, appInfo, logger))
38
52
  .then((_appInfo) => {
39
53
  const appInfo = {
40
54
  appId: _appInfo.appId,
41
55
  objectId: _appInfo.id,
42
- // based on the assumption that we're adding AAD app to the current
43
- // directory. If we in the future extend the command with allowing
44
- // users to create AAD app in a different directory, we'll need to
45
- // adjust this
46
- tenantId: Utils_1.default.getTenantIdFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken)
56
+ tenantId: _appInfo.tenantId
47
57
  };
48
58
  if (_appInfo.secret) {
49
59
  appInfo.secret = _appInfo.secret;
@@ -60,6 +70,7 @@ class AadAppAddCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
60
70
  if (!applicationInfo.displayName && this.manifest) {
61
71
  applicationInfo.displayName = this.manifest.name;
62
72
  }
73
+ this.appName = applicationInfo.displayName;
63
74
  if (apis.length > 0) {
64
75
  applicationInfo.requiredResourceAccess = apis;
65
76
  }
@@ -332,6 +343,45 @@ class AadAppAddCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
332
343
  return Promise.resolve(appInfo);
333
344
  });
334
345
  }
346
+ saveAppInfo(args, appInfo, logger) {
347
+ if (!args.options.save) {
348
+ return Promise.resolve(appInfo);
349
+ }
350
+ const filePath = '.m365rc.json';
351
+ if (this.verbose) {
352
+ logger.logToStderr(`Saving Azure AD app registration information to the ${filePath} file...`);
353
+ }
354
+ let m365rc = {};
355
+ if (fs.existsSync(filePath)) {
356
+ if (this.debug) {
357
+ logger.logToStderr(`Reading existing ${filePath}...`);
358
+ }
359
+ try {
360
+ const fileContents = fs.readFileSync(filePath, 'utf8');
361
+ if (fileContents) {
362
+ m365rc = JSON.parse(fileContents);
363
+ }
364
+ }
365
+ catch (e) {
366
+ logger.logToStderr(`Error reading ${filePath}: ${e}. Please add app info to ${filePath} manually.`);
367
+ return Promise.resolve(appInfo);
368
+ }
369
+ }
370
+ if (!m365rc.apps) {
371
+ m365rc.apps = [];
372
+ }
373
+ m365rc.apps.push({
374
+ appId: appInfo.appId,
375
+ name: this.appName
376
+ });
377
+ try {
378
+ fs.writeFileSync(filePath, JSON.stringify(m365rc, null, 2));
379
+ }
380
+ catch (e) {
381
+ logger.logToStderr(`Error writing ${filePath}: ${e}. Please add app info to ${filePath} manually.`);
382
+ }
383
+ return Promise.resolve(appInfo);
384
+ }
335
385
  options() {
336
386
  const options = [
337
387
  {
@@ -377,6 +427,9 @@ class AadAppAddCommand extends GraphItemsListCommand_1.GraphItemsListCommand {
377
427
  },
378
428
  {
379
429
  option: '--manifest [manifest]'
430
+ },
431
+ {
432
+ option: '--save'
380
433
  }
381
434
  ];
382
435
  const parentOptions = super.options();
@@ -5,6 +5,7 @@ const path = require("path");
5
5
  const request_1 = require("../../../../request");
6
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
7
  const commands_1 = require("../../commands");
8
+ const Utils_1 = require("../../../../Utils");
8
9
  class AadO365GroupAddCommand extends GraphCommand_1.default {
9
10
  get name() {
10
11
  return commands_1.default.O365GROUP_ADD;
@@ -14,6 +15,8 @@ class AadO365GroupAddCommand extends GraphCommand_1.default {
14
15
  }
15
16
  commandAction(logger, args, cb) {
16
17
  let group;
18
+ let ownerIds = [];
19
+ let memberIds = [];
17
20
  if (this.verbose) {
18
21
  logger.logToStderr(`Creating Microsoft 365 Group...`);
19
22
  }
@@ -35,8 +38,16 @@ class AadO365GroupAddCommand extends GraphCommand_1.default {
35
38
  visibility: args.options.isPrivate === 'true' ? 'Private' : 'Public'
36
39
  }
37
40
  };
38
- request_1.default
39
- .post(requestOptions)
41
+ this
42
+ .getUserIds(logger, args.options.owners)
43
+ .then((ownerIdsRes) => {
44
+ ownerIds = ownerIdsRes;
45
+ return this.getUserIds(logger, args.options.members);
46
+ })
47
+ .then((memberIdsRes) => {
48
+ memberIds = memberIdsRes;
49
+ return request_1.default.post(requestOptions);
50
+ })
40
51
  .then((res) => {
41
52
  group = res;
42
53
  if (!args.options.logoPath) {
@@ -61,72 +72,32 @@ class AadO365GroupAddCommand extends GraphCommand_1.default {
61
72
  });
62
73
  })
63
74
  .then(() => {
64
- if (!args.options.owners) {
65
- if (this.debug) {
66
- logger.logToStderr('Owners not set. Skipping');
67
- }
68
- return Promise.resolve(undefined);
69
- }
70
- const owners = args.options.owners.split(',').map(o => o.trim());
71
- if (this.verbose) {
72
- logger.logToStderr('Retrieving user information to set group owners...');
73
- }
74
- const requestOptions = {
75
- url: `${this.resource}/v1.0/users?$filter=${owners.map(o => `userPrincipalName eq '${o}'`).join(' or ')}&$select=id`,
76
- headers: {
77
- 'content-type': 'application/json'
78
- },
79
- responseType: 'json'
80
- };
81
- return request_1.default.get(requestOptions);
82
- })
83
- .then((res) => {
84
- if (!res) {
85
- return Promise.resolve();
75
+ if (ownerIds.length === 0) {
76
+ return Promise.resolve([]);
86
77
  }
87
- return Promise.all(res.value.map(u => request_1.default.post({
78
+ return Promise.all(ownerIds.map(ownerId => request_1.default.post({
88
79
  url: `${this.resource}/v1.0/groups/${group.id}/owners/$ref`,
89
80
  headers: {
90
81
  'content-type': 'application/json'
91
82
  },
92
83
  responseType: 'json',
93
84
  data: {
94
- "@odata.id": `https://graph.microsoft.com/v1.0/users/${u.id}`
85
+ "@odata.id": `https://graph.microsoft.com/v1.0/users/${ownerId}`
95
86
  }
96
87
  })));
97
88
  })
98
89
  .then(() => {
99
- if (!args.options.members) {
100
- if (this.debug) {
101
- logger.logToStderr('Members not set. Skipping');
102
- }
103
- return Promise.resolve(undefined);
104
- }
105
- const members = args.options.members.split(',').map(o => o.trim());
106
- if (this.verbose) {
107
- logger.logToStderr('Retrieving user information to set group members...');
108
- }
109
- const requestOptions = {
110
- url: `${this.resource}/v1.0/users?$filter=${members.map(o => `userPrincipalName eq '${o}'`).join(' or ')}&$select=id`,
111
- headers: {
112
- 'content-type': 'application/json'
113
- },
114
- responseType: 'json'
115
- };
116
- return request_1.default.get(requestOptions);
117
- })
118
- .then((res) => {
119
- if (!res) {
120
- return Promise.resolve();
90
+ if (memberIds.length === 0) {
91
+ return Promise.resolve([]);
121
92
  }
122
- return Promise.all(res.value.map(u => request_1.default.post({
93
+ return Promise.all(memberIds.map(memberId => request_1.default.post({
123
94
  url: `${this.resource}/v1.0/groups/${group.id}/members/$ref`,
124
95
  headers: {
125
96
  'content-type': 'application/json'
126
97
  },
127
98
  responseType: 'json',
128
99
  data: {
129
- "@odata.id": `https://graph.microsoft.com/v1.0/users/${u.id}`
100
+ "@odata.id": `https://graph.microsoft.com/v1.0/users/${memberId}`
130
101
  }
131
102
  })));
132
103
  })
@@ -135,6 +106,41 @@ class AadO365GroupAddCommand extends GraphCommand_1.default {
135
106
  cb();
136
107
  }, (rawRes) => this.handleRejectedODataJsonPromise(rawRes, logger, cb));
137
108
  }
109
+ getUserIds(logger, users) {
110
+ if (!users) {
111
+ if (this.debug) {
112
+ logger.logToStderr('No users to validate, skipping.');
113
+ }
114
+ return Promise.resolve([]);
115
+ }
116
+ if (this.verbose) {
117
+ logger.logToStderr('Retrieving user information.');
118
+ }
119
+ const userArr = users.split(',').map(o => o.trim());
120
+ let promises = [];
121
+ let userIds = [];
122
+ promises = userArr.map(user => {
123
+ const requestOptions = {
124
+ url: `${this.resource}/v1.0/users?$filter=userPrincipalName eq '${Utils_1.default.encodeQueryParameter(user)}'&$select=id,userPrincipalName`,
125
+ headers: {
126
+ 'content-type': 'application/json'
127
+ },
128
+ responseType: 'json'
129
+ };
130
+ return request_1.default.get(requestOptions);
131
+ });
132
+ return Promise.all(promises).then((usersRes) => {
133
+ let userUpns = [];
134
+ userUpns = usersRes.map(res => { var _a; return (_a = res.value[0]) === null || _a === void 0 ? void 0 : _a.userPrincipalName; });
135
+ userIds = usersRes.map(res => { var _a; return (_a = res.value[0]) === null || _a === void 0 ? void 0 : _a.id; });
136
+ // Find the members where no graph response was found
137
+ const invalidUsers = userArr.filter(user => !userUpns.some((upn) => (upn === null || upn === void 0 ? void 0 : upn.toLowerCase()) === user.toLowerCase()));
138
+ if (invalidUsers && invalidUsers.length > 0) {
139
+ return Promise.reject(`Cannot proceed with group creation. The following users provided are invalid : ${invalidUsers.join(',')}`);
140
+ }
141
+ return Promise.resolve(userIds);
142
+ });
143
+ }
138
144
  setGroupLogo(requestOptions, retryLeft, resolve, reject, logger) {
139
145
  request_1.default
140
146
  .put(requestOptions)
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=M365RcJson.js.map
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const FN001001_DEP_microsoft_sp_core_library_1 = require("./rules/FN001001_DEP_microsoft_sp_core_library");
4
+ const FN001002_DEP_microsoft_sp_lodash_subset_1 = require("./rules/FN001002_DEP_microsoft_sp_lodash_subset");
5
+ const FN001003_DEP_microsoft_sp_office_ui_fabric_core_1 = require("./rules/FN001003_DEP_microsoft_sp_office_ui_fabric_core");
6
+ const FN001004_DEP_microsoft_sp_webpart_base_1 = require("./rules/FN001004_DEP_microsoft_sp_webpart_base");
7
+ const FN001011_DEP_microsoft_sp_dialog_1 = require("./rules/FN001011_DEP_microsoft_sp_dialog");
8
+ const FN001012_DEP_microsoft_sp_application_base_1 = require("./rules/FN001012_DEP_microsoft_sp_application_base");
9
+ const FN001013_DEP_microsoft_decorators_1 = require("./rules/FN001013_DEP_microsoft_decorators");
10
+ const FN001014_DEP_microsoft_sp_listview_extensibility_1 = require("./rules/FN001014_DEP_microsoft_sp_listview_extensibility");
11
+ const FN001021_DEP_microsoft_sp_property_pane_1 = require("./rules/FN001021_DEP_microsoft_sp_property_pane");
12
+ const FN001023_DEP_microsoft_sp_component_base_1 = require("./rules/FN001023_DEP_microsoft_sp_component_base");
13
+ const FN001024_DEP_microsoft_sp_diagnostics_1 = require("./rules/FN001024_DEP_microsoft_sp_diagnostics");
14
+ const FN001025_DEP_microsoft_sp_dynamic_data_1 = require("./rules/FN001025_DEP_microsoft_sp_dynamic_data");
15
+ const FN001026_DEP_microsoft_sp_extension_base_1 = require("./rules/FN001026_DEP_microsoft_sp_extension_base");
16
+ const FN001027_DEP_microsoft_sp_http_1 = require("./rules/FN001027_DEP_microsoft_sp_http");
17
+ const FN001028_DEP_microsoft_sp_list_subscription_1 = require("./rules/FN001028_DEP_microsoft_sp_list_subscription");
18
+ const FN001029_DEP_microsoft_sp_loader_1 = require("./rules/FN001029_DEP_microsoft_sp_loader");
19
+ const FN001030_DEP_microsoft_sp_module_interfaces_1 = require("./rules/FN001030_DEP_microsoft_sp_module_interfaces");
20
+ const FN001031_DEP_microsoft_sp_odata_types_1 = require("./rules/FN001031_DEP_microsoft_sp_odata_types");
21
+ const FN001032_DEP_microsoft_sp_page_context_1 = require("./rules/FN001032_DEP_microsoft_sp_page_context");
22
+ const FN002001_DEVDEP_microsoft_sp_build_web_1 = require("./rules/FN002001_DEVDEP_microsoft_sp_build_web");
23
+ const FN002002_DEVDEP_microsoft_sp_module_interfaces_1 = require("./rules/FN002002_DEVDEP_microsoft_sp_module_interfaces");
24
+ const FN002009_DEVDEP_microsoft_sp_tslint_rules_1 = require("./rules/FN002009_DEVDEP_microsoft_sp_tslint_rules");
25
+ const FN006004_CFG_PS_developer_1 = require("./rules/FN006004_CFG_PS_developer");
26
+ const FN010001_YORC_version_1 = require("./rules/FN010001_YORC_version");
27
+ module.exports = [
28
+ new FN001001_DEP_microsoft_sp_core_library_1.FN001001_DEP_microsoft_sp_core_library('1.13.1'),
29
+ new FN001002_DEP_microsoft_sp_lodash_subset_1.FN001002_DEP_microsoft_sp_lodash_subset('1.13.1'),
30
+ new FN001003_DEP_microsoft_sp_office_ui_fabric_core_1.FN001003_DEP_microsoft_sp_office_ui_fabric_core('1.13.1'),
31
+ new FN001004_DEP_microsoft_sp_webpart_base_1.FN001004_DEP_microsoft_sp_webpart_base('1.13.1'),
32
+ new FN001011_DEP_microsoft_sp_dialog_1.FN001011_DEP_microsoft_sp_dialog('1.13.1'),
33
+ new FN001012_DEP_microsoft_sp_application_base_1.FN001012_DEP_microsoft_sp_application_base('1.13.1'),
34
+ new FN001013_DEP_microsoft_decorators_1.FN001013_DEP_microsoft_decorators('1.13.1'),
35
+ new FN001014_DEP_microsoft_sp_listview_extensibility_1.FN001014_DEP_microsoft_sp_listview_extensibility('1.13.1'),
36
+ new FN001021_DEP_microsoft_sp_property_pane_1.FN001021_DEP_microsoft_sp_property_pane('1.13.1'),
37
+ new FN001023_DEP_microsoft_sp_component_base_1.FN001023_DEP_microsoft_sp_component_base('1.13.1'),
38
+ new FN001024_DEP_microsoft_sp_diagnostics_1.FN001024_DEP_microsoft_sp_diagnostics('1.13.1'),
39
+ new FN001025_DEP_microsoft_sp_dynamic_data_1.FN001025_DEP_microsoft_sp_dynamic_data('1.13.1'),
40
+ new FN001026_DEP_microsoft_sp_extension_base_1.FN001026_DEP_microsoft_sp_extension_base('1.13.1'),
41
+ new FN001027_DEP_microsoft_sp_http_1.FN001027_DEP_microsoft_sp_http('1.13.1'),
42
+ new FN001028_DEP_microsoft_sp_list_subscription_1.FN001028_DEP_microsoft_sp_list_subscription('1.13.1'),
43
+ new FN001029_DEP_microsoft_sp_loader_1.FN001029_DEP_microsoft_sp_loader('1.13.1'),
44
+ new FN001030_DEP_microsoft_sp_module_interfaces_1.FN001030_DEP_microsoft_sp_module_interfaces('1.13.1'),
45
+ new FN001031_DEP_microsoft_sp_odata_types_1.FN001031_DEP_microsoft_sp_odata_types('1.13.1'),
46
+ new FN001032_DEP_microsoft_sp_page_context_1.FN001032_DEP_microsoft_sp_page_context('1.13.1'),
47
+ new FN002001_DEVDEP_microsoft_sp_build_web_1.FN002001_DEVDEP_microsoft_sp_build_web('1.13.1'),
48
+ new FN002002_DEVDEP_microsoft_sp_module_interfaces_1.FN002002_DEVDEP_microsoft_sp_module_interfaces('1.13.1'),
49
+ new FN002009_DEVDEP_microsoft_sp_tslint_rules_1.FN002009_DEVDEP_microsoft_sp_tslint_rules('1.13.1'),
50
+ new FN006004_CFG_PS_developer_1.FN006004_CFG_PS_developer('1.13.1'),
51
+ new FN010001_YORC_version_1.FN010001_YORC_version('1.13.1')
52
+ ];
53
+ //# sourceMappingURL=upgrade-1.13.1.js.map
@@ -41,7 +41,8 @@ class SpfxProjectUpgradeCommand extends base_project_command_1.BaseProjectComman
41
41
  '1.11.0',
42
42
  '1.12.0',
43
43
  '1.12.1',
44
- '1.13.0'
44
+ '1.13.0',
45
+ '1.13.1'
45
46
  ];
46
47
  }
47
48
  get name() {
@@ -433,6 +433,25 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
433
433
  range: '^4',
434
434
  fix: 'npm i -g yo@4'
435
435
  }
436
+ },
437
+ '1.13.1': {
438
+ gulp: {
439
+ range: '^4',
440
+ fix: 'npm i -g gulp@4'
441
+ },
442
+ node: {
443
+ range: '^12 || ^14',
444
+ fix: 'Install Node.js v12 or v14'
445
+ },
446
+ react: {
447
+ range: '16.9.0',
448
+ fix: 'npm i react@16.9.0'
449
+ },
450
+ sp: SharePointVersion.SPO,
451
+ yo: {
452
+ range: '^4',
453
+ fix: 'npm i -g yo@4'
454
+ }
436
455
  }
437
456
  };
438
457
  }
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const request_1 = require("../../../../request");
4
+ const SpoCommand_1 = require("../../../base/SpoCommand");
5
+ const commands_1 = require("../../commands");
6
+ class SpoContentTypeListCommand extends SpoCommand_1.default {
7
+ get name() {
8
+ return commands_1.default.CONTENTTYPE_LIST;
9
+ }
10
+ get description() {
11
+ return 'Lists all available content types in the specified site';
12
+ }
13
+ defaultProperties() {
14
+ return ['StringId', 'Name', 'Hidden', 'ReadOnly', 'Sealed'];
15
+ }
16
+ commandAction(logger, args, cb) {
17
+ let requestUrl = `${args.options.webUrl}/_api/web/ContentTypes`;
18
+ if (args.options.category) {
19
+ requestUrl += `?$filter=Group eq '${encodeURIComponent(args.options.category)}'`;
20
+ }
21
+ const requestOptions = {
22
+ url: requestUrl,
23
+ headers: {
24
+ accept: 'application/json;odata=nometadata'
25
+ },
26
+ responseType: 'json'
27
+ };
28
+ request_1.default
29
+ .get(requestOptions)
30
+ .then((res) => {
31
+ logger.log(res.value);
32
+ cb();
33
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
34
+ }
35
+ options() {
36
+ const options = [
37
+ {
38
+ option: '-u, --webUrl <webUrl>'
39
+ },
40
+ {
41
+ option: '-c, --category [category]'
42
+ }
43
+ ];
44
+ const parentOptions = super.options();
45
+ return options.concat(parentOptions);
46
+ }
47
+ validate(args) {
48
+ return SpoCommand_1.default.isValidSharePointUrl(args.options.webUrl);
49
+ }
50
+ }
51
+ module.exports = new SpoContentTypeListCommand();
52
+ //# sourceMappingURL=contenttype-list.js.map
@@ -1,10 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Page = void 0;
3
+ exports.Page = exports.supportedPromoteAs = exports.supportedPageLayouts = void 0;
4
4
  const request_1 = require("../../../../request");
5
5
  const Utils_1 = require("../../../../Utils");
6
6
  const clientsidepages_1 = require("./clientsidepages");
7
7
  const pageMethods_1 = require("./pageMethods");
8
+ exports.supportedPageLayouts = ['Article', 'Home', 'SingleWebPartAppPage', 'RepostPage', 'HeaderlessSearchResults', 'Spaces', 'Topic'];
9
+ exports.supportedPromoteAs = ['HomePage', 'NewsPage', 'Template'];
8
10
  class Page {
9
11
  static getPage(name, webUrl, logger, debug, verbose) {
10
12
  return new Promise((resolve, reject) => {
@@ -284,11 +284,11 @@ class SpoPageAddCommand extends SpoCommand_1.default {
284
284
  },
285
285
  {
286
286
  option: '-l, --layoutType [layoutType]',
287
- autocomplete: ['Article', 'Home']
287
+ autocomplete: Page_1.supportedPageLayouts
288
288
  },
289
289
  {
290
290
  option: '-p, --promoteAs [promoteAs]',
291
- autocomplete: ['HomePage', 'NewsPage', 'Template']
291
+ autocomplete: Page_1.supportedPromoteAs
292
292
  },
293
293
  {
294
294
  option: '--commentsEnabled'
@@ -312,20 +312,17 @@ class SpoPageAddCommand extends SpoCommand_1.default {
312
312
  return isValidSharePointUrl;
313
313
  }
314
314
  if (args.options.layoutType &&
315
- args.options.layoutType !== 'Article' &&
316
- args.options.layoutType !== 'Home') {
317
- return `${args.options.layoutType} is not a valid option for layoutType. Allowed values Article|Home`;
315
+ Page_1.supportedPageLayouts.indexOf(args.options.layoutType) < 0) {
316
+ return `${args.options.layoutType} is not a valid option for layoutType. Allowed values ${Page_1.supportedPageLayouts.join(', ')}`;
318
317
  }
319
318
  if (args.options.promoteAs &&
320
- args.options.promoteAs !== 'HomePage' &&
321
- args.options.promoteAs !== 'NewsPage' &&
322
- args.options.promoteAs !== 'Template') {
323
- return `${args.options.promoteAs} is not a valid option for promoteAs. Allowed values HomePage|NewsPage|Template`;
319
+ Page_1.supportedPromoteAs.indexOf(args.options.promoteAs) < 0) {
320
+ return `${args.options.promoteAs} is not a valid option for promoteAs. Allowed values ${Page_1.supportedPromoteAs.join(', ')}`;
324
321
  }
325
322
  if (args.options.promoteAs === 'HomePage' && args.options.layoutType !== 'Home') {
326
323
  return 'You can only promote home pages as site home page';
327
324
  }
328
- if (args.options.promoteAs === 'NewsPage' && args.options.layoutType === 'Home') {
325
+ if (args.options.promoteAs === 'NewsPage' && args.options.layoutType && args.options.layoutType !== 'Article') {
329
326
  return 'You can only promote article pages as news article';
330
327
  }
331
328
  return true;
@@ -283,11 +283,11 @@ class SpoPageSetCommand extends SpoCommand_1.default {
283
283
  },
284
284
  {
285
285
  option: '-l, --layoutType [layoutType]',
286
- autocomplete: ['Article', 'Home']
286
+ autocomplete: Page_1.supportedPageLayouts
287
287
  },
288
288
  {
289
289
  option: '-p, --promoteAs [promoteAs]',
290
- autocomplete: ['HomePage', 'NewsPage', 'Template']
290
+ autocomplete: Page_1.supportedPromoteAs
291
291
  },
292
292
  {
293
293
  option: '--commentsEnabled [commentsEnabled]',
@@ -315,20 +315,17 @@ class SpoPageSetCommand extends SpoCommand_1.default {
315
315
  return isValidSharePointUrl;
316
316
  }
317
317
  if (args.options.layoutType &&
318
- args.options.layoutType !== 'Article' &&
319
- args.options.layoutType !== 'Home') {
320
- return `${args.options.layoutType} is not a valid option for layoutType. Allowed values Article|Home`;
318
+ Page_1.supportedPageLayouts.indexOf(args.options.layoutType) < 0) {
319
+ return `${args.options.layoutType} is not a valid option for layoutType. Allowed values ${Page_1.supportedPageLayouts.join(', ')}`;
321
320
  }
322
321
  if (args.options.promoteAs &&
323
- args.options.promoteAs !== 'HomePage' &&
324
- args.options.promoteAs !== 'NewsPage' &&
325
- args.options.promoteAs !== 'Template') {
326
- return `${args.options.promoteAs} is not a valid option for promoteAs. Allowed values HomePage|NewsPage|Template`;
322
+ Page_1.supportedPromoteAs.indexOf(args.options.promoteAs) < 0) {
323
+ return `${args.options.promoteAs} is not a valid option for promoteAs. Allowed values ${Page_1.supportedPromoteAs.join(', ')}`;
327
324
  }
328
325
  if (args.options.promoteAs === 'HomePage' && args.options.layoutType !== 'Home') {
329
326
  return 'You can only promote home pages as site home page';
330
327
  }
331
- if (args.options.promoteAs === 'NewsPage' && args.options.layoutType === 'Home') {
328
+ if (args.options.promoteAs === 'NewsPage' && args.options.layoutType && args.options.layoutType !== 'Article') {
332
329
  return 'You can only promote article pages as news article';
333
330
  }
334
331
  if (typeof args.options.commentsEnabled !== 'undefined' &&
@@ -22,9 +22,10 @@ exports.default = {
22
22
  CDN_POLICY_SET: `${prefix} cdn policy set`,
23
23
  CDN_SET: `${prefix} cdn set`,
24
24
  CONTENTTYPE_ADD: `${prefix} contenttype add`,
25
- CONTENTTYPE_GET: `${prefix} contenttype get`,
26
25
  CONTENTTYPE_FIELD_REMOVE: `${prefix} contenttype field remove`,
27
26
  CONTENTTYPE_FIELD_SET: `${prefix} contenttype field set`,
27
+ CONTENTTYPE_GET: `${prefix} contenttype get`,
28
+ CONTENTTYPE_LIST: `${prefix} contenttype list`,
28
29
  CONTENTTYPE_REMOVE: `${prefix} contenttype remove`,
29
30
  CONTENTTYPEHUB_GET: `${prefix} contenttypehub get`,
30
31
  CUSTOMACTION_ADD: `${prefix} customaction add`,
@@ -52,6 +52,9 @@ m365 aad app add [options]
52
52
  `--manifest [manifest]`
53
53
  : Azure AD app manifest as retrieved from the Azure Portal to create the app registration from
54
54
 
55
+ `--save`
56
+ : Use to store the information about the created app in a local file
57
+
55
58
  --8<-- "docs/cmd/_global.md"
56
59
 
57
60
  ## Remarks
@@ -80,6 +83,8 @@ When using the `withSecret` option, this command will automatically generate a s
80
83
 
81
84
  After creating the Azure AD app registration, this command returns the app ID and object ID of the created app registration. If you used the `withSecret` option, it will also return the generated secret.
82
85
 
86
+ If you want to store the information about the created Azure AD app registration, use the `--save` option. This is useful when you build solutions connected to Microsoft 365 and want to easily manage app registrations used with your solution. When you use the `--save` option, after you create the app registration, the command will write its ID and name to the `.m365rc.json` file in the current directory. If the file already exists, it will add the information about the to it, allowing you to track multiple apps. If the file doesn't exist, the command will create it.
87
+
83
88
  ## Examples
84
89
 
85
90
  Create new Azure AD app registration with the specified name
@@ -141,3 +146,9 @@ Create new Azure AD app registration with Application ID URI set to a value that
141
146
  ```sh
142
147
  m365 aad app add --name 'My AAD app' --uri api://caf406b91cd4.ngrok.io/_appId_ --scopeName access_as_user --scopeAdminConsentDescription 'Access as a user' --scopeAdminConsentDisplayName 'Access as a user' --scopeConsentBy adminsAndUsers
143
148
  ```
149
+
150
+ Create new Azure AD app registration with the specified name. Store information about the created app registration in the _.m365rc.json_ file in the current directory.
151
+
152
+ ```sh
153
+ m365 aad app add --name 'My AAD app' --save
154
+ ```
@@ -36,6 +36,7 @@ m365 aad o365group add [options]
36
36
  ## Remarks
37
37
 
38
38
  When specifying the path to the logo image you can use both relative and absolute paths. Note, that ~ in the path, will not be resolved and will most likely result in an error.
39
+ If an invalid user is provided in the comma-separated list or Owners or Members, the command operation will fail and the Micrsoft 365 Group will not be created.
39
40
 
40
41
  ## Examples
41
42
 
@@ -32,7 +32,7 @@ m365 spfx project upgrade [options]
32
32
 
33
33
  ## Remarks
34
34
 
35
- The `spfx project upgrade` command helps you upgrade your SharePoint Framework project to the specified version. If no version is specified, the command will upgrade to the latest version of the SharePoint Framework it supports (v1.13.0).
35
+ The `spfx project upgrade` command helps you upgrade your SharePoint Framework project to the specified version. If no version is specified, the command will upgrade to the latest version of the SharePoint Framework it supports (v1.13.1).
36
36
 
37
37
  This command doesn't change your project files. Instead, it gives you a report with all steps necessary to upgrade your project to the specified version of the SharePoint Framework. Changing project files is error-prone, especially when it comes to updating your solution's code. This is why at this moment, this command produces a report that you can use yourself to perform the necessary updates and verify that everything is working as expected.
38
38
 
@@ -0,0 +1,33 @@
1
+ # spo contenttype list
2
+
3
+ Lists content types from specified site
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 spo contenttype list [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-u, --webUrl <webUrl>`
14
+ : Absolute URL of the site for which to list content types
15
+
16
+ `-c, --category [category]`
17
+ : Category name of content types. When defined will return only content types from specified category
18
+
19
+ --8<-- "docs/cmd/_global.md"
20
+
21
+ ## Examples
22
+
23
+ Retrieve site content types
24
+
25
+ ```PowerShell
26
+ m365 spo contenttype list --webUrl "https://contoso.sharepoint.com/sites/contoso-sales"
27
+ ```
28
+
29
+ Retrieve site content types from the 'List Content Types' category
30
+
31
+ ```PowerShell
32
+ m365 spo contenttype list --webUrl "https://contoso.sharepoint.com/sites/contoso-sales" --category "List Content Types"
33
+ ```
@@ -20,10 +20,10 @@ m365 spo page add [options]
20
20
  : Title of the page to create. If not specified, will use the page name as its title
21
21
 
22
22
  `-l, --layoutType [layoutType]`
23
- : Layout of the page. Allowed values `Article,Home`. Default `Article`
23
+ : Layout of the page. Allowed values `Article`, `Home`, `SingleWebPartAppPage`, `RepostPage`,`HeaderlessSearchResults`, `Spaces`, `Topic`. Default `Article`
24
24
 
25
25
  `-p, --promoteAs [promoteAs]`
26
- : Create the page for a specific purpose. Allowed values `HomePage,NewsPage`
26
+ : Create the page for a specific purpose. Allowed values `HomePage`, `NewsPage`
27
27
 
28
28
  `--commentsEnabled`
29
29
  : Set to enable comments on the page
@@ -17,13 +17,13 @@ m365 spo page set [options]
17
17
  : URL of the site where the page to update is located
18
18
 
19
19
  `-l, --layoutType [layoutType]`
20
- : Layout of the page. Allowed values `Article,Home`
20
+ : Layout of the page. Allowed values `Article`, `Home`, `SingleWebPartAppPage`, `RepostPage`,`HeaderlessSearchResults`, `Spaces`, `Topic`
21
21
 
22
22
  `-p, --promoteAs [promoteAs]`
23
- : Update the page purpose. Allowed values `HomePage,NewsPage`
23
+ : Update the page purpose. Allowed values `HomePage`, `NewsPage`
24
24
 
25
25
  `--commentsEnabled [commentsEnabled]`
26
- : Set to `true`, to enable comments on the page. Allowed values `true,false`
26
+ : Set to `true`, to enable comments on the page. Allowed values `true`, `false`
27
27
 
28
28
  `--publish`
29
29
  : Set to publish the page
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "5.0.0-beta.431ccea",
3
+ "version": "5.0.0-beta.563b474",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",