@pnp/cli-microsoft365 6.0.0-beta.3f3b164 → 6.0.0-beta.4d2402f

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.
@@ -9,9 +9,6 @@ class AadAppRemoveCommand extends GraphCommand_1.default {
9
9
  get name() {
10
10
  return commands_1.default.APP_REMOVE;
11
11
  }
12
- alias() {
13
- return [commands_1.default.APP_DELETE];
14
- }
15
12
  get description() {
16
13
  return 'Removes an Azure AD app registration';
17
14
  }
@@ -24,7 +21,6 @@ class AadAppRemoveCommand extends GraphCommand_1.default {
24
21
  return telemetryProps;
25
22
  }
26
23
  commandAction(logger, args, cb) {
27
- this.showDeprecationWarning(logger, commands_1.default.APP_DELETE, commands_1.default.APP_REMOVE);
28
24
  const deleteApp = () => {
29
25
  this
30
26
  .getObjectId(args, logger)
@@ -12,9 +12,6 @@ class AadAppRoleRemoveCommand extends GraphCommand_1.default {
12
12
  get description() {
13
13
  return 'Removes role from the specified Azure AD app registration';
14
14
  }
15
- alias() {
16
- return [commands_1.default.APP_ROLE_DELETE];
17
- }
18
15
  getTelemetryProperties(args) {
19
16
  const telemetryProps = super.getTelemetryProperties(args);
20
17
  telemetryProps.appId = typeof args.options.appId !== 'undefined';
@@ -26,7 +23,6 @@ class AadAppRoleRemoveCommand extends GraphCommand_1.default {
26
23
  return telemetryProps;
27
24
  }
28
25
  commandAction(logger, args, cb) {
29
- this.showDeprecationWarning(logger, commands_1.default.APP_ROLE_DELETE, commands_1.default.APP_ROLE_REMOVE);
30
26
  const deleteAppRole = () => {
31
27
  this
32
28
  .processAppRoleDelete(logger, args)
@@ -3,11 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'aad';
4
4
  exports.default = {
5
5
  APP_ADD: `${prefix} app add`,
6
- APP_DELETE: `${prefix} app delete`,
7
6
  APP_GET: `${prefix} app get`,
8
7
  APP_REMOVE: `${prefix} app remove`,
9
8
  APP_ROLE_ADD: `${prefix} app role add`,
10
- APP_ROLE_DELETE: `${prefix} app role delete`,
11
9
  APP_ROLE_LIST: `${prefix} app role list`,
12
10
  APP_ROLE_REMOVE: `${prefix} app role remove`,
13
11
  APP_SET: `${prefix} app set`,
@@ -16,6 +16,7 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
16
16
  getTelemetryProperties(args) {
17
17
  const telemetryProps = super.getTelemetryProperties(args);
18
18
  telemetryProps.id = typeof args.options.id !== 'undefined';
19
+ telemetryProps.title = typeof args.options.title !== 'undefined';
19
20
  telemetryProps.name = typeof args.options.name !== 'undefined';
20
21
  telemetryProps.listId = typeof args.options.listId !== 'undefined';
21
22
  telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
@@ -26,6 +27,9 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
26
27
  return true;
27
28
  }
28
29
  commandAction(logger, args, cb) {
30
+ if (args.options.name) {
31
+ this.warn(logger, `Option 'name' is deprecated. Please use 'title' instead.`);
32
+ }
29
33
  let requestDigest = '';
30
34
  utils_1.spo
31
35
  .getRequestDigest(args.options.webUrl)
@@ -61,7 +65,7 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
61
65
  // retrieve column CSOM object id
62
66
  const fieldQuery = args.options.id ?
63
67
  `<Method Id="663" ParentId="7" Name="GetById"><Parameters><Parameter Type="Guid">${utils_1.formatting.escapeXml(args.options.id)}</Parameter></Parameters></Method>` :
64
- `<Method Id="663" ParentId="7" Name="GetByInternalNameOrTitle"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(args.options.name)}</Parameter></Parameters></Method>`;
68
+ `<Method Id="663" ParentId="7" Name="GetByInternalNameOrTitle"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(args.options.name || args.options.title)}</Parameter></Parameters></Method>`;
65
69
  const requestOptions = {
66
70
  url: `${args.options.webUrl}/_vti_bin/client.svc/ProcessQuery`,
67
71
  headers: {
@@ -105,6 +109,7 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
105
109
  'listTitle',
106
110
  'id',
107
111
  'name',
112
+ 'title',
108
113
  'updateExistingLists',
109
114
  'debug',
110
115
  'verbose',
@@ -116,6 +121,11 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
116
121
  }).join('');
117
122
  return payload;
118
123
  }
124
+ optionSets() {
125
+ return [
126
+ ['id', 'title', 'name']
127
+ ];
128
+ }
119
129
  options() {
120
130
  const options = [
121
131
  {
@@ -128,10 +138,13 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
128
138
  option: '--listTitle [listTitle]'
129
139
  },
130
140
  {
131
- option: '-i|--id [id]'
141
+ option: '-i, --id [id]'
132
142
  },
133
143
  {
134
- option: '-n|--name [name]'
144
+ option: '-n, --name [name]'
145
+ },
146
+ {
147
+ option: '-t, --title [title]'
135
148
  },
136
149
  {
137
150
  option: '--updateExistingLists'
@@ -152,12 +165,6 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
152
165
  !utils_1.validation.isValidGuid(args.options.listId)) {
153
166
  return `${args.options.listId} in option listId is not a valid GUID`;
154
167
  }
155
- if (!args.options.id && !args.options.name) {
156
- return `Specify id or name`;
157
- }
158
- if (args.options.id && args.options.name) {
159
- return `Specify viewId or viewTitle but not both`;
160
- }
161
168
  if (args.options.id &&
162
169
  !utils_1.validation.isValidGuid(args.options.id)) {
163
170
  return `${args.options.id} in option id is not a valid GUID`;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../../../../utils");
4
+ const request_1 = require("../../../../request");
5
+ const SpoCommand_1 = require("../../../base/SpoCommand");
6
+ const commands_1 = require("../../commands");
7
+ class SpoGroupAddCommand extends SpoCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.GROUP_ADD;
10
+ }
11
+ get description() {
12
+ return 'Creates group in the specified site';
13
+ }
14
+ getTelemetryProperties(args) {
15
+ const telemetryProps = super.getTelemetryProperties(args);
16
+ telemetryProps.description = typeof args.options.description !== 'undefined';
17
+ telemetryProps.allowMembersEditMembership = typeof args.options.allowMembersEditMembership !== 'undefined';
18
+ telemetryProps.onlyAllowMembersViewMembership = typeof args.options.onlyAllowMembersViewMembership !== 'undefined';
19
+ telemetryProps.allowRequestToJoinLeave = typeof args.options.allowRequestToJoinLeave !== 'undefined';
20
+ telemetryProps.autoAcceptRequestToJoinLeave = typeof args.options.autoAcceptRequestToJoinLeave !== 'undefined';
21
+ telemetryProps.requestToJoinLeaveEmailSetting = typeof args.options.requestToJoinLeaveEmailSetting !== 'undefined';
22
+ return telemetryProps;
23
+ }
24
+ commandAction(logger, args, cb) {
25
+ const requestOptions = {
26
+ url: `${args.options.webUrl}/_api/web/sitegroups`,
27
+ headers: {
28
+ accept: 'application/json;odata=nometadata'
29
+ },
30
+ responseType: 'json',
31
+ data: {
32
+ Title: args.options.name,
33
+ Description: args.options.description,
34
+ AllowMembersEditMembership: args.options.allowMembersEditMembership,
35
+ OnlyAllowMembersViewMembership: args.options.onlyAllowMembersViewMembership,
36
+ AllowRequestToJoinLeave: args.options.allowRequestToJoinLeave,
37
+ AutoAcceptRequestToJoinLeave: args.options.autoAcceptRequestToJoinLeave,
38
+ RequestToJoinLeaveEmailSetting: args.options.requestToJoinLeaveEmailSetting
39
+ }
40
+ };
41
+ request_1.default
42
+ .post(requestOptions)
43
+ .then((response) => {
44
+ logger.log(response);
45
+ cb();
46
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
47
+ }
48
+ options() {
49
+ const options = [
50
+ {
51
+ option: '-u, --webUrl <webUrl>'
52
+ },
53
+ {
54
+ option: '-n, --name <name>'
55
+ },
56
+ {
57
+ option: '--description [description]'
58
+ },
59
+ {
60
+ option: '--allowMembersEditMembership [allowMembersEditMembership]'
61
+ },
62
+ {
63
+ option: '--onlyAllowMembersViewMembership [onlyAllowMembersViewMembership]'
64
+ },
65
+ {
66
+ option: '--allowRequestToJoinLeave [allowRequestToJoinLeave]'
67
+ },
68
+ {
69
+ option: '--autoAcceptRequestToJoinLeave [autoAcceptRequestToJoinLeave]'
70
+ },
71
+ {
72
+ option: '--requestToJoinLeaveEmailSetting [requestToJoinLeaveEmailSetting]'
73
+ }
74
+ ];
75
+ const parentOptions = super.options();
76
+ return options.concat(parentOptions);
77
+ }
78
+ validate(args) {
79
+ const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
80
+ if (isValidSharePointUrl !== true) {
81
+ return isValidSharePointUrl;
82
+ }
83
+ const booleanOptions = [
84
+ args.options.allowMembersEditMembership, args.options.onlyAllowMembersViewMembership,
85
+ args.options.allowRequestToJoinLeave, args.options.autoAcceptRequestToJoinLeave
86
+ ];
87
+ for (const option of booleanOptions) {
88
+ if (typeof option !== 'undefined' && !utils_1.validation.isValidBoolean(option)) {
89
+ return `Value '${option}' is not a valid boolean`;
90
+ }
91
+ }
92
+ return true;
93
+ }
94
+ }
95
+ module.exports = new SpoGroupAddCommand();
96
+ //# sourceMappingURL=group-add.js.map
@@ -0,0 +1,167 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const AadUserGetCommand = require("../../../aad/commands/user/user-get");
4
+ const cli_1 = require("../../../../cli");
5
+ const utils_1 = require("../../../../utils");
6
+ const request_1 = require("../../../../request");
7
+ const SpoCommand_1 = require("../../../base/SpoCommand");
8
+ const commands_1 = require("../../commands");
9
+ class SpoGroupSetCommand extends SpoCommand_1.default {
10
+ get name() {
11
+ return commands_1.default.GROUP_SET;
12
+ }
13
+ get description() {
14
+ return 'Updates a group in the specified site';
15
+ }
16
+ getTelemetryProperties(args) {
17
+ const telemetryProps = super.getTelemetryProperties(args);
18
+ telemetryProps.id = typeof args.options.id !== 'undefined';
19
+ telemetryProps.name = typeof args.options.name !== 'undefined';
20
+ telemetryProps.newName = typeof args.options.newName !== 'undefined';
21
+ telemetryProps.description = typeof args.options.description !== 'undefined';
22
+ telemetryProps.allowMembersEditMembership = typeof args.options.allowMembersEditMembership !== 'undefined';
23
+ telemetryProps.onlyAllowMembersViewMembership = typeof args.options.onlyAllowMembersViewMembership !== 'undefined';
24
+ telemetryProps.allowRequestToJoinLeave = typeof args.options.allowRequestToJoinLeave !== 'undefined';
25
+ telemetryProps.autoAcceptRequestToJoinLeave = typeof args.options.autoAcceptRequestToJoinLeave !== 'undefined';
26
+ telemetryProps.requestToJoinLeaveEmailSetting = typeof args.options.requestToJoinLeaveEmailSetting !== 'undefined';
27
+ telemetryProps.ownerEmail = typeof args.options.ownerEmail !== 'undefined';
28
+ telemetryProps.ownerUserName = typeof args.options.ownerUserName !== 'undefined';
29
+ return telemetryProps;
30
+ }
31
+ commandAction(logger, args, cb) {
32
+ const requestOptions = {
33
+ url: `${args.options.webUrl}/_api/web/sitegroups/${args.options.id ? `GetById(${args.options.id})` : `GetByName('${args.options.name}')`}`,
34
+ headers: {
35
+ accept: 'application/json;odata.metadata=none',
36
+ 'content-type': 'application/json'
37
+ },
38
+ responseType: 'json',
39
+ data: {
40
+ Title: args.options.newName,
41
+ Description: args.options.description,
42
+ AllowMembersEditMembership: args.options.allowMembersEditMembership,
43
+ OnlyAllowMembersViewMembership: args.options.onlyAllowMembersViewMembership,
44
+ AllowRequestToJoinLeave: args.options.allowRequestToJoinLeave,
45
+ AutoAcceptRequestToJoinLeave: args.options.autoAcceptRequestToJoinLeave,
46
+ RequestToJoinLeaveEmailSetting: args.options.requestToJoinLeaveEmailSetting
47
+ }
48
+ };
49
+ request_1.default
50
+ .patch(requestOptions)
51
+ .then(() => this.setGroupOwner(args.options))
52
+ .then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
53
+ }
54
+ setGroupOwner(options) {
55
+ if (!options.ownerEmail && !options.ownerUserName) {
56
+ return Promise.resolve();
57
+ }
58
+ return this
59
+ .getOwnerId(options)
60
+ .then((ownerId) => {
61
+ const requestOptions = {
62
+ url: `${options.webUrl}/_api/web/sitegroups/${options.id ? `GetById(${options.id})` : `GetByName('${options.name}')`}/SetUserAsOwner(${ownerId})`,
63
+ headers: {
64
+ accept: 'application/json;odata.metadata=none',
65
+ 'content-type': 'application/json'
66
+ },
67
+ responseType: 'json'
68
+ };
69
+ return request_1.default.post(requestOptions);
70
+ });
71
+ }
72
+ getOwnerId(options) {
73
+ const cmdOptions = {
74
+ userName: options.ownerUserName,
75
+ email: options.ownerEmail,
76
+ output: 'json',
77
+ debug: options.debug,
78
+ verbose: options.verbose
79
+ };
80
+ return cli_1.Cli
81
+ .executeCommandWithOutput(AadUserGetCommand, { options: Object.assign(Object.assign({}, cmdOptions), { _: [] }) })
82
+ .then((output) => {
83
+ const getUserOutput = JSON.parse(output.stdout);
84
+ const requestOptions = {
85
+ url: `${options.webUrl}/_api/web/ensureUser('${getUserOutput.userPrincipalName}')?$select=Id`,
86
+ headers: {
87
+ accept: 'application/json',
88
+ 'content-type': 'application/json'
89
+ },
90
+ responseType: 'json'
91
+ };
92
+ return request_1.default.post(requestOptions);
93
+ })
94
+ .then((response) => response.Id);
95
+ }
96
+ options() {
97
+ const options = [
98
+ {
99
+ option: '-u, --webUrl <webUrl>'
100
+ },
101
+ {
102
+ option: '-i, --id [id]'
103
+ },
104
+ {
105
+ option: '-n, --name [name]'
106
+ },
107
+ {
108
+ option: '--newName [newName]'
109
+ },
110
+ {
111
+ option: '--description [description]'
112
+ },
113
+ {
114
+ option: '--allowMembersEditMembership [allowMembersEditMembership]'
115
+ },
116
+ {
117
+ option: '--onlyAllowMembersViewMembership [onlyAllowMembersViewMembership]'
118
+ },
119
+ {
120
+ option: '--allowRequestToJoinLeave [allowRequestToJoinLeave]'
121
+ },
122
+ {
123
+ option: '--autoAcceptRequestToJoinLeave [autoAcceptRequestToJoinLeave]'
124
+ },
125
+ {
126
+ option: '--requestToJoinLeaveEmailSetting [requestToJoinLeaveEmailSetting]'
127
+ },
128
+ {
129
+ option: '--ownerEmail [ownerEmail]'
130
+ },
131
+ {
132
+ option: '--ownerUserName [ownerUserName]'
133
+ }
134
+ ];
135
+ const parentOptions = super.options();
136
+ return options.concat(parentOptions);
137
+ }
138
+ optionSets() {
139
+ return [
140
+ ['id', 'name']
141
+ ];
142
+ }
143
+ validate(args) {
144
+ const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
145
+ if (isValidSharePointUrl !== true) {
146
+ return isValidSharePointUrl;
147
+ }
148
+ if (args.options.id && isNaN(args.options.id)) {
149
+ return `Specified id ${args.options.id} is not a number`;
150
+ }
151
+ if (args.options.ownerEmail && args.options.ownerUserName) {
152
+ return 'Specify either ownerEmail or ownerUserName but not both';
153
+ }
154
+ const booleanOptions = [
155
+ args.options.allowMembersEditMembership, args.options.onlyAllowMembersViewMembership,
156
+ args.options.allowRequestToJoinLeave, args.options.autoAcceptRequestToJoinLeave
157
+ ];
158
+ for (const option of booleanOptions) {
159
+ if (typeof option !== 'undefined' && !utils_1.validation.isValidBoolean(option)) {
160
+ return `Value '${option}' is not a valid boolean`;
161
+ }
162
+ }
163
+ return true;
164
+ }
165
+ }
166
+ module.exports = new SpoGroupSetCommand();
167
+ //# sourceMappingURL=group-set.js.map
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const cli_1 = require("../../../../cli");
3
4
  const request_1 = require("../../../../request");
4
5
  const utils_1 = require("../../../../utils");
5
6
  const SpoCommand_1 = require("../../../base/SpoCommand");
6
7
  const commands_1 = require("../../commands");
8
+ const SpoListItemListCommand = require("../listitem/listitem-list");
7
9
  class SpoHubSiteGetCommand extends SpoCommand_1.default {
8
10
  get name() {
9
11
  return commands_1.default.HUBSITE_GET;
@@ -16,9 +18,24 @@ class SpoHubSiteGetCommand extends SpoCommand_1.default {
16
18
  telemetryProps.id = typeof args.options.id !== 'undefined';
17
19
  telemetryProps.title = typeof args.options.title !== 'undefined';
18
20
  telemetryProps.url = typeof args.options.url !== 'undefined';
21
+ telemetryProps.includeAssociatedSites = args.options.includeAssociatedSites === true;
19
22
  return telemetryProps;
20
23
  }
24
+ getAssociatedSites(spoAdminUrl, hubSiteId, logger, args) {
25
+ const options = {
26
+ output: 'json',
27
+ debug: args.options.debug,
28
+ verbose: args.options.verbose,
29
+ listTitle: 'DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS',
30
+ webUrl: spoAdminUrl,
31
+ filter: `HubSiteId eq '${hubSiteId}'`,
32
+ fields: 'Title,SiteUrl,SiteId'
33
+ };
34
+ return cli_1.Cli
35
+ .executeCommandWithOutput(SpoListItemListCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
36
+ }
21
37
  commandAction(logger, args, cb) {
38
+ let hubSite;
22
39
  utils_1.spo
23
40
  .getSpoUrl(logger, this.debug)
24
41
  .then((spoUrl) => {
@@ -30,7 +47,25 @@ class SpoHubSiteGetCommand extends SpoCommand_1.default {
30
47
  }
31
48
  })
32
49
  .then((res) => {
33
- logger.log(res);
50
+ hubSite = res;
51
+ if (args.options.includeAssociatedSites && (args.options.output && args.options.output !== 'json')) {
52
+ throw Error('includeAssociatedSites option is only allowed with json output mode');
53
+ }
54
+ if (args.options.includeAssociatedSites !== true || args.options.output && args.options.output !== 'json') {
55
+ return Promise.resolve();
56
+ }
57
+ return utils_1.spo
58
+ .getSpoAdminUrl(logger, this.debug)
59
+ .then((spoAdminUrl) => {
60
+ return this.getAssociatedSites(spoAdminUrl, hubSite.SiteId, logger, args);
61
+ });
62
+ })
63
+ .then((associatedSitesCommandOutput) => {
64
+ if (args.options.includeAssociatedSites) {
65
+ const associatedSites = JSON.parse(associatedSitesCommandOutput.stdout);
66
+ hubSite.AssociatedSites = associatedSites.filter(s => s.SiteId !== hubSite.SiteId);
67
+ }
68
+ logger.log(hubSite);
34
69
  cb();
35
70
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
36
71
  }
@@ -75,7 +110,8 @@ class SpoHubSiteGetCommand extends SpoCommand_1.default {
75
110
  const options = [
76
111
  { option: '-i, --id [id]' },
77
112
  { option: '-t, --title [title]' },
78
- { option: '-u, --url [url]' }
113
+ { option: '-u, --url [url]' },
114
+ { option: '--includeAssociatedSites' }
79
115
  ];
80
116
  const parentOptions = super.options();
81
117
  return options.concat(parentOptions);
@@ -13,10 +13,8 @@ class SpoListItemListCommand extends SpoCommand_1.default {
13
13
  }
14
14
  getTelemetryProperties(args) {
15
15
  const telemetryProps = super.getTelemetryProperties(args);
16
- telemetryProps.id = typeof args.options.id !== 'undefined';
17
16
  telemetryProps.listId = typeof args.options.listId !== 'undefined';
18
17
  telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
19
- telemetryProps.title = typeof args.options.title !== 'undefined';
20
18
  telemetryProps.fields = typeof args.options.fields !== 'undefined';
21
19
  telemetryProps.filter = typeof args.options.filter !== 'undefined';
22
20
  telemetryProps.pageNumber = typeof args.options.pageNumber !== 'undefined';
@@ -25,14 +23,8 @@ class SpoListItemListCommand extends SpoCommand_1.default {
25
23
  return telemetryProps;
26
24
  }
27
25
  commandAction(logger, args, cb) {
28
- if (args.options.id) {
29
- this.warn(logger, `Option 'id' is deprecated. Please use 'listId' instead.`);
30
- }
31
- if (args.options.title) {
32
- this.warn(logger, `Option 'title' is deprecated. Please use 'listTitle' instead.`);
33
- }
34
- const listIdArgument = args.options.listId || args.options.id || '';
35
- const listTitleArgument = args.options.listTitle || args.options.title || '';
26
+ const listIdArgument = args.options.listId || '';
27
+ const listTitleArgument = args.options.listTitle || '';
36
28
  let formDigestValue = '';
37
29
  const fieldsArray = args.options.fields ? args.options.fields.split(",")
38
30
  : (!args.options.output || args.options.output === "text") ? ["Title", "Id"] : [];
@@ -111,12 +103,6 @@ class SpoListItemListCommand extends SpoCommand_1.default {
111
103
  {
112
104
  option: '-u, --webUrl <webUrl>'
113
105
  },
114
- {
115
- option: '--id [id]'
116
- },
117
- {
118
- option: '--title [title]'
119
- },
120
106
  {
121
107
  option: '-i, --listId [listId]'
122
108
  },
@@ -161,14 +147,10 @@ class SpoListItemListCommand extends SpoCommand_1.default {
161
147
  if (isValidSharePointUrl !== true) {
162
148
  return isValidSharePointUrl;
163
149
  }
164
- if (!args.options.id && !args.options.title && !args.options.listId && !args.options.listTitle) {
150
+ if (!args.options.listId && !args.options.listTitle) {
165
151
  return `Specify listId or listTitle`;
166
152
  }
167
- if (args.options.id && args.options.title) {
168
- return `Specify list id or title but not both`;
169
- }
170
- // Check if only one of the 4 options is specified
171
- if ([args.options.id, args.options.title, args.options.listId, args.options.listTitle].filter(o => o).length > 1) {
153
+ if (args.options.listId && args.options.listTitle) {
172
154
  return 'Specify listId or listTitle but not both';
173
155
  }
174
156
  if (args.options.camlQuery && args.options.fields) {
@@ -192,9 +174,6 @@ class SpoListItemListCommand extends SpoCommand_1.default {
192
174
  if (args.options.listId && !utils_1.validation.isValidGuid(args.options.listId)) {
193
175
  return `${args.options.listId} is not a valid GUID`;
194
176
  }
195
- if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
196
- return `${args.options.id} in option id is not a valid GUID`;
197
- }
198
177
  return true;
199
178
  }
200
179
  }
@@ -63,9 +63,11 @@ exports.default = {
63
63
  FOLDER_REMOVE: `${prefix} folder remove`,
64
64
  FOLDER_RENAME: `${prefix} folder rename`,
65
65
  GET: `${prefix} get`,
66
+ GROUP_ADD: `${prefix} group add`,
66
67
  GROUP_GET: `${prefix} group get`,
67
68
  GROUP_LIST: `${prefix} group list`,
68
69
  GROUP_REMOVE: `${prefix} group remove`,
70
+ GROUP_SET: `${prefix} group set`,
69
71
  GROUP_USER_ADD: `${prefix} group user add`,
70
72
  GROUP_USER_LIST: `${prefix} group user list`,
71
73
  GROUP_USER_REMOVE: `${prefix} group user remove`,
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const request_1 = require("../../../../request");
4
4
  const utils_1 = require("../../../../utils");
5
+ const aadGroup_1 = require("../../../../utils/aadGroup");
5
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
7
  const commands_1 = require("../../commands");
7
8
  class TeamsTeamArchiveCommand extends GraphCommand_1.default {
@@ -16,27 +17,53 @@ class TeamsTeamArchiveCommand extends GraphCommand_1.default {
16
17
  telemetryProps.shouldSetSpoSiteReadOnlyForMembers = args.options.shouldSetSpoSiteReadOnlyForMembers === true;
17
18
  return telemetryProps;
18
19
  }
20
+ getTeamId(args) {
21
+ if (args.options.id) {
22
+ return Promise.resolve(args.options.id);
23
+ }
24
+ return aadGroup_1.aadGroup
25
+ .getGroupByDisplayName(args.options.name)
26
+ .then(group => {
27
+ if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
28
+ return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
29
+ }
30
+ return group.id;
31
+ });
32
+ }
19
33
  commandAction(logger, args, cb) {
34
+ if (args.options.teamId) {
35
+ args.options.id = args.options.teamId;
36
+ this.warn(logger, `Option 'teamId' is deprecated. Please use 'id' instead.`);
37
+ }
20
38
  const siteReadOnlyForMembers = args.options.shouldSetSpoSiteReadOnlyForMembers === true;
21
- const requestOptions = {
22
- url: `${this.resource}/v1.0/teams/${encodeURIComponent(args.options.teamId)}/archive`,
23
- headers: {
24
- 'content-type': 'application/json;odata=nometadata',
25
- 'accept': 'application/json;odata.metadata=none'
26
- },
27
- responseType: 'json',
28
- data: {
29
- shouldSetSpoSiteReadOnlyForMembers: siteReadOnlyForMembers
30
- }
31
- };
32
- request_1.default
33
- .post(requestOptions)
39
+ this
40
+ .getTeamId(args)
41
+ .then((teamId) => {
42
+ const requestOptions = {
43
+ url: `${this.resource}/v1.0/teams/${encodeURIComponent(teamId)}/archive`,
44
+ headers: {
45
+ 'content-type': 'application/json;odata=nometadata',
46
+ 'accept': 'application/json;odata.metadata=none'
47
+ },
48
+ responseType: 'json',
49
+ data: {
50
+ shouldSetSpoSiteReadOnlyForMembers: siteReadOnlyForMembers
51
+ }
52
+ };
53
+ return request_1.default.post(requestOptions);
54
+ })
34
55
  .then(_ => cb(), (res) => this.handleRejectedODataJsonPromise(res, logger, cb));
35
56
  }
36
57
  options() {
37
58
  const options = [
38
59
  {
39
- option: '-i, --teamId <teamId>'
60
+ option: '-i, --id [id]'
61
+ },
62
+ {
63
+ option: '-n, --name [name]'
64
+ },
65
+ {
66
+ option: '--teamId [teamId]'
40
67
  },
41
68
  {
42
69
  option: '--shouldSetSpoSiteReadOnlyForMembers'
@@ -46,9 +73,18 @@ class TeamsTeamArchiveCommand extends GraphCommand_1.default {
46
73
  return options.concat(parentOptions);
47
74
  }
48
75
  validate(args) {
49
- if (!utils_1.validation.isValidGuid(args.options.teamId)) {
76
+ if (!args.options.id && !args.options.name && !args.options.teamId) {
77
+ return 'Specify either id or name';
78
+ }
79
+ if (args.options.name && (args.options.id || args.options.teamId)) {
80
+ return 'Specify either id or name but not both';
81
+ }
82
+ if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
50
83
  return `${args.options.teamId} is not a valid GUID`;
51
84
  }
85
+ if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
86
+ return `${args.options.id} is not a valid GUID`;
87
+ }
52
88
  return true;
53
89
  }
54
90
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const cli_1 = require("../../../../cli");
4
4
  const request_1 = require("../../../../request");
5
5
  const utils_1 = require("../../../../utils");
6
+ const aadGroup_1 = require("../../../../utils/aadGroup");
6
7
  const GraphCommand_1 = require("../../../base/GraphCommand");
7
8
  const commands_1 = require("../../commands");
8
9
  class TeamsTeamRemoveCommand extends GraphCommand_1.default {
@@ -17,17 +18,37 @@ class TeamsTeamRemoveCommand extends GraphCommand_1.default {
17
18
  telemetryProps.confirm = (!(!args.options.confirm)).toString();
18
19
  return telemetryProps;
19
20
  }
21
+ getTeamId(args) {
22
+ if (args.options.id) {
23
+ return Promise.resolve(args.options.id);
24
+ }
25
+ return aadGroup_1.aadGroup
26
+ .getGroupByDisplayName(args.options.name)
27
+ .then(group => {
28
+ if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
29
+ return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
30
+ }
31
+ return group.id;
32
+ });
33
+ }
20
34
  commandAction(logger, args, cb) {
35
+ if (args.options.teamId) {
36
+ args.options.id = args.options.teamId;
37
+ this.warn(logger, `Option 'teamId' is deprecated. Please use 'id' instead.`);
38
+ }
21
39
  const removeTeam = () => {
22
- const requestOptions = {
23
- url: `${this.resource}/v1.0/groups/${encodeURIComponent(args.options.teamId)}`,
24
- headers: {
25
- accept: 'application/json;odata.metadata=none'
26
- },
27
- responseType: 'json'
28
- };
29
- request_1.default
30
- .delete(requestOptions)
40
+ this
41
+ .getTeamId(args)
42
+ .then((teamId) => {
43
+ const requestOptions = {
44
+ url: `${this.resource}/v1.0/groups/${encodeURIComponent(teamId)}`,
45
+ headers: {
46
+ accept: 'application/json;odata.metadata=none'
47
+ },
48
+ responseType: 'json'
49
+ };
50
+ return request_1.default.delete(requestOptions);
51
+ })
31
52
  .then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
32
53
  };
33
54
  if (args.options.confirm) {
@@ -52,7 +73,13 @@ class TeamsTeamRemoveCommand extends GraphCommand_1.default {
52
73
  options() {
53
74
  const options = [
54
75
  {
55
- option: '-i, --teamId <teamId>'
76
+ option: '-i, --id [id]'
77
+ },
78
+ {
79
+ option: '-n, --name [name]'
80
+ },
81
+ {
82
+ option: '--teamId [teamId]'
56
83
  },
57
84
  {
58
85
  option: '--confirm'
@@ -62,9 +89,18 @@ class TeamsTeamRemoveCommand extends GraphCommand_1.default {
62
89
  return options.concat(parentOptions);
63
90
  }
64
91
  validate(args) {
65
- if (!utils_1.validation.isValidGuid(args.options.teamId)) {
92
+ if (!args.options.id && !args.options.name && !args.options.teamId) {
93
+ return 'Specify either id or name';
94
+ }
95
+ if (args.options.name && (args.options.id || args.options.teamId)) {
96
+ return 'Specify either id or name but not both';
97
+ }
98
+ if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
66
99
  return `${args.options.teamId} is not a valid GUID`;
67
100
  }
101
+ if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
102
+ return `${args.options.id} is not a valid GUID`;
103
+ }
68
104
  return true;
69
105
  }
70
106
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const request_1 = require("../../../../request");
4
4
  const utils_1 = require("../../../../utils");
5
+ const aadGroup_1 = require("../../../../utils/aadGroup");
5
6
  const GraphCommand_1 = require("../../../base/GraphCommand");
6
7
  const commands_1 = require("../../commands");
7
8
  class TeamsTeamUnarchiveCommand extends GraphCommand_1.default {
@@ -11,33 +12,68 @@ class TeamsTeamUnarchiveCommand extends GraphCommand_1.default {
11
12
  get description() {
12
13
  return 'Restores an archived Microsoft Teams team';
13
14
  }
15
+ getTeamId(args) {
16
+ if (args.options.id) {
17
+ return Promise.resolve(args.options.id);
18
+ }
19
+ return aadGroup_1.aadGroup
20
+ .getGroupByDisplayName(args.options.name)
21
+ .then(group => {
22
+ if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
23
+ return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
24
+ }
25
+ return group.id;
26
+ });
27
+ }
14
28
  commandAction(logger, args, cb) {
29
+ if (args.options.teamId) {
30
+ args.options.id = args.options.teamId;
31
+ this.warn(logger, `Option 'teamId' is deprecated. Please use 'id' instead.`);
32
+ }
15
33
  const endpoint = `${this.resource}/v1.0`;
16
- const requestOptions = {
17
- url: `${endpoint}/teams/${encodeURIComponent(args.options.teamId)}/unarchive`,
18
- headers: {
19
- 'content-type': 'application/json;odata=nometadata',
20
- 'accept': 'application/json;odata.metadata=none'
21
- },
22
- responseType: 'json'
23
- };
24
- request_1.default
25
- .post(requestOptions)
34
+ this
35
+ .getTeamId(args)
36
+ .then((teamId) => {
37
+ const requestOptions = {
38
+ url: `${endpoint}/teams/${encodeURIComponent(teamId)}/unarchive`,
39
+ headers: {
40
+ 'content-type': 'application/json;odata=nometadata',
41
+ 'accept': 'application/json;odata.metadata=none'
42
+ },
43
+ responseType: 'json'
44
+ };
45
+ return request_1.default.post(requestOptions);
46
+ })
26
47
  .then(_ => cb(), (res) => this.handleRejectedODataJsonPromise(res, logger, cb));
27
48
  }
28
49
  options() {
29
50
  const options = [
30
51
  {
31
- option: '-i, --teamId <teamId>'
52
+ option: '-i, --id [id]'
53
+ },
54
+ {
55
+ option: '-n, --name [name]'
56
+ },
57
+ {
58
+ option: '--teamId [teamId]'
32
59
  }
33
60
  ];
34
61
  const parentOptions = super.options();
35
62
  return options.concat(parentOptions);
36
63
  }
37
64
  validate(args) {
38
- if (!utils_1.validation.isValidGuid(args.options.teamId)) {
65
+ if (!args.options.id && !args.options.name && !args.options.teamId) {
66
+ return 'Specify either id or name';
67
+ }
68
+ if (args.options.name && (args.options.id || args.options.teamId)) {
69
+ return 'Specify either id or name but not both';
70
+ }
71
+ if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
39
72
  return `${args.options.teamId} is not a valid GUID`;
40
73
  }
74
+ if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
75
+ return `${args.options.id} is not a valid GUID`;
76
+ }
41
77
  return true;
42
78
  }
43
79
  }
@@ -8,12 +8,6 @@ Removes an Azure AD app registration
8
8
  m365 aad app remove [options]
9
9
  ```
10
10
 
11
- ## Alias
12
-
13
- ```sh
14
- m365 aad app delete [options]
15
- ```
16
-
17
11
  ## Options
18
12
 
19
13
  `--appId [appId]`
@@ -8,12 +8,6 @@ Removes role from the specified Azure AD app registration
8
8
  m365 aad app role remove [options]
9
9
  ```
10
10
 
11
- ## Alias
12
-
13
- ```sh
14
- m365 aad app role delete [options]
15
- ```
16
-
17
11
  ## Options
18
12
 
19
13
  `--appId [appId]`
@@ -8,6 +8,12 @@ Retrieve the specified planner task
8
8
  m365 planner task get [options]
9
9
  ```
10
10
 
11
+ ## Alias
12
+
13
+ ```sh
14
+ m365 planner task details get [options]
15
+ ```
16
+
11
17
  ## Options
12
18
 
13
19
  `-i, --id [id]`
@@ -20,10 +20,13 @@ m365 spo field set [options]
20
20
  : Title of the list where the field is located (if list column). Specify `listTitle` or `listId` but not both
21
21
 
22
22
  `-i, --id [id]`
23
- : ID of the field to update. Specify `name` or `id` but not both
23
+ : ID of the field to update. Specify `id` or `title` but not both
24
+
25
+ `-t, --title [title]`
26
+ : Title or internal name of the field to update. Specify `id` or `title` but not both
24
27
 
25
28
  `-n, --name [name]`
26
- : Title or internal name of the field to update. Specify `name` or `id` but not both
29
+ : (deprecated. Use `title` instead) Title or internal name of the field to update. Specify `id` or `name` but not both
27
30
 
28
31
  `--updateExistingLists`
29
32
  : Set, to push the update to existing lists. Otherwise, the changes will apply to new lists only
@@ -39,7 +42,7 @@ Specify properties to update using their names, eg. `--Title 'New Title' --JSLin
39
42
  Update the title of the site column specified by its internal name and push changes to existing lists
40
43
 
41
44
  ```sh
42
- m365 spo field set --webUrl https://contoso.sharepoint.com/sites/project-x --name 'MyColumn' --updateExistingLists --Title 'My column'
45
+ m365 spo field set --webUrl https://contoso.sharepoint.com/sites/project-x --title 'MyColumn' --updateExistingLists --Title 'My column'
43
46
  ```
44
47
 
45
48
  Update the title of the list column specified by its ID
@@ -51,5 +54,5 @@ m365 spo field set --webUrl https://contoso.sharepoint.com/sites/project-x --lis
51
54
  Update column formatting of the specified list column
52
55
 
53
56
  ```sh
54
- m365 spo field set --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'My List' --name 'MyColumn' --CustomFormatter '`{"schema":"https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField"}`'
57
+ m365 spo field set --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'My List' --title 'MyColumn' --CustomFormatter '`{"schema":"https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json", "elmType": "div", "txtContent": "@currentField"}`'
55
58
  ```
@@ -0,0 +1,51 @@
1
+ # spo group add
2
+
3
+ Creates group in the specified site
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 spo group add [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-u, --webUrl <webUrl>`
14
+ : URL of the site where the group should be added.
15
+
16
+ `-n, --name <name>`
17
+ : Name of the group to add.
18
+
19
+ `--description [description]`
20
+ : The description for the group.
21
+
22
+ `--allowMembersEditMembership [allowMembersEditMembership]`
23
+ : Who can edit the membership of the group? When `true` members can edit membership, otherwise only owners can do this. Default `false`.
24
+
25
+ `--onlyAllowMembersViewMembership [onlyAllowMembersViewMembership]`
26
+ : Who can view the membership of the group? When `false` everyone can view the group membership, otherwise only group members can. Default `true`.
27
+
28
+ `--allowRequestToJoinLeave [allowRequestToJoinLeave]`
29
+ : Specify whether to allow users to request membership in this group and allow users to request to leave the group. Default `false`.
30
+
31
+ `--autoAcceptRequestToJoinLeave [autoAcceptRequestToJoinLeave]`
32
+ : If auto-accept is enabled, users will automatically be added or removed when they make a request. Default `false`.
33
+
34
+ `--requestToJoinLeaveEmailSetting [requestToJoinLeaveEmailSetting]`
35
+ : All membership requests will be sent to the email address specified.
36
+
37
+ --8<-- "docs/cmd/_global.md"
38
+
39
+ ## Examples
40
+
41
+ Create group with title and description
42
+
43
+ ```sh
44
+ m365 spo group add --webUrl https://contoso.sharepoint.com/sites/project-x --name "Project leaders" --description "This group contains all project leaders"
45
+ ```
46
+
47
+ Create group with membership requests
48
+
49
+ ```sh
50
+ m365 spo group add --webUrl https://contoso.sharepoint.com/sites/project-x --name "Project leaders" --allowRequestToJoinLeave true --requestToJoinLeaveEmailSetting john.doe@contoso.com
51
+ ```
@@ -0,0 +1,69 @@
1
+ # spo group set
2
+
3
+ Updates a group in the specified site
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 spo group set [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-u, --webUrl <webUrl>`
14
+ : URL of the site where the group is located.
15
+
16
+ `-i, --id [id]`
17
+ : ID of the group to update. Specify either `id` or `name` but not both.
18
+
19
+ `-n, --name [name]`
20
+ : Name of the group. Specify either `id` or `name` but not both.
21
+
22
+ `--newName [newName]`
23
+ : New name for the group.
24
+
25
+ `--description [description]`
26
+ : The description for the group.
27
+
28
+ `--allowMembersEditMembership [allowMembersEditMembership]`
29
+ : Who can edit the membership of the group? When `true` members can edit membership, otherwise only owners can do this.
30
+
31
+ `--onlyAllowMembersViewMembership [onlyAllowMembersViewMembership]`
32
+ : Who can view the membership of the group? When `true` only group members can view the membership, otherwise everyone can.
33
+
34
+ `--allowRequestToJoinLeave [allowRequestToJoinLeave]`
35
+ : Specify whether to allow users to request membership in this group and allow users to request to leave the group.
36
+
37
+ `--autoAcceptRequestToJoinLeave [autoAcceptRequestToJoinLeave]`
38
+ : If auto-accept is enabled, users will automatically be added or removed when they make a request.
39
+
40
+ `--requestToJoinLeaveEmailSetting [requestToJoinLeaveEmailSetting]`
41
+ : All membership requests will be sent to the email address specified.
42
+
43
+ `--ownerEmail [ownerEmail]`
44
+ : Set user with this email as owner of the group. Specify either `ownerEmail` or `ownerUserName` but not both.
45
+
46
+ `--ownerUserName [ownerUserName]`
47
+ : Set user with this login name as owner of the group. Specify either `ownerEmail` or `ownerUserName` but not both.
48
+
49
+ --8<-- "docs/cmd/_global.md"
50
+
51
+ ## Examples
52
+
53
+ Update group title and description
54
+
55
+ ```sh
56
+ m365 spo group set --webUrl https://contoso.sharepoint.com/sites/project-x --id 18 --newTitle "Project leaders" --description "This group contains all project leaders"
57
+ ```
58
+
59
+ Update group with membership requests
60
+
61
+ ```sh
62
+ m365 spo group set --webUrl https://contoso.sharepoint.com/sites/project-x --title "Project leaders" --allowRequestToJoinLeave true --requestToJoinLeaveEmailSetting john.doe@contoso.com
63
+ ```
64
+
65
+ Sets a specified user as group owner
66
+
67
+ ```sh
68
+ m365 spo group set --webUrl https://contoso.sharepoint.com/sites/project-x --id 18 --ownerEmail john.doe@contoso.com
69
+ ```
@@ -19,6 +19,9 @@ m365 spo hubsite get [options]
19
19
  `-u, --url [url]`
20
20
  : URL of the hubsite. Specify either `id`, `title` or `url` but not multiple.
21
21
 
22
+ `--includeAssociatedSites`
23
+ : Include the associated sites in the result (only in JSON output)
24
+
22
25
  --8<-- "docs/cmd/_global.md"
23
26
 
24
27
  ## Examples
@@ -41,6 +44,24 @@ Get information about the hub site with URL _https://contoso.sharepoint.com/site
41
44
  m365 spo hubsite get --url 'https://contoso.sharepoint.com/sites/HubSite'
42
45
  ```
43
46
 
47
+ Get information about the hub site with ID _2c1ba4c4-cd9b-4417-832f-92a34bc34b2a_, including its associated sites. Associated site info is only shown in JSON output.
48
+
49
+ ```sh
50
+ m365 spo hubsite get --id 2c1ba4c4-cd9b-4417-832f-92a34bc34b2a --includeAssociatedSites --output json
51
+ ```
52
+
53
+ Get information about the hub site with Title _My Hub Site_
54
+
55
+ ```sh
56
+ m365 spo hubsite get --title "My Hub Site"
57
+ ```
58
+
59
+ Get information about the hub site with URL _https://contoso.sharepoint.com/sites/HubSite_
60
+
61
+ ```sh
62
+ m365 spo hubsite get --url "https://contoso.sharepoint.com/sites/HubSite"
63
+ ```
64
+
44
65
  ## More information
45
66
 
46
67
  - SharePoint hub sites new in Microsoft 365: [https://techcommunity.microsoft.com/t5/SharePoint-Blog/SharePoint-hub-sites-new-in-Office-365/ba-p/109547](https://techcommunity.microsoft.com/t5/SharePoint-Blog/SharePoint-hub-sites-new-in-Office-365/ba-p/109547)
@@ -16,15 +16,9 @@ m365 spo listitem list [options]
16
16
  `-i, --listId [listId]`
17
17
  : ID of the list to retrieve items from. Specify `listId` or `listTitle` but not both
18
18
 
19
- `--id [id]`
20
- : (deprecated. Use `listId` instead) ID of the list to retrieve items from. Specify `id` or `title` but not both
21
-
22
19
  `-t, --listTitle [listTitle]`
23
20
  : Title of the list to retrieve items from. Specify `listId` or `listTitle` but not both
24
21
 
25
- `--title [title]`
26
- : (deprecated. Use `listTitle` instead) Title of the list to retrieve items from. Specify `id` or `title` but not both
27
-
28
22
  `-q, --camlQuery [camlQuery]`
29
23
  : CAML query to use to query the list of items with
30
24
 
@@ -10,8 +10,14 @@ m365 teams team archive [options]
10
10
 
11
11
  ## Options
12
12
 
13
- `-i, --teamId <teamId>`
14
- : The ID of the Microsoft Teams team to archive
13
+ `-i, --id [id]`
14
+ : The ID of the Microsoft Teams team to archive. Specify either id or name but not both
15
+
16
+ `-n, --name [name]`
17
+ : The display name of the Microsoft Teams team to archive. Specify either id or name but not both
18
+
19
+ `--teamId [teamId]`
20
+ : (deprecated. Use `id` instead) The ID of the Microsoft Teams team to archive
15
21
 
16
22
  `--shouldSetSpoSiteReadOnlyForMembers`
17
23
  : Sets the permissions for team members to read-only on the SharePoint Online site associated with the team
@@ -22,18 +28,27 @@ m365 teams team archive [options]
22
28
 
23
29
  Using this command, global admins and Microsoft Teams service admins can access teams that they are not a member of.
24
30
 
31
+ If the command finds multiple Microsoft Teams teams with the specified name, it will prompt you to disambiguate which team it should use, listing the discovered team IDs.
32
+
25
33
  When a team is archived, users can no longer send or like messages on any channel in the team, edit the team's name, description, or other settings, or in general make most changes to the team. Membership changes to the team continue to be allowed.
26
34
 
35
+
27
36
  ## Examples
28
37
 
29
- Archive the specified Microsoft Teams team
38
+ Archive the specified Microsoft Teams team with id _6f6fd3f7-9ba5-4488-bbe6-a789004d0d55_
39
+
40
+ ```sh
41
+ m365 teams team archive --id 6f6fd3f7-9ba5-4488-bbe6-a789004d0d55
42
+ ```
43
+
44
+ Archive the specified Microsoft Teams team with name _Team Name_
30
45
 
31
46
  ```sh
32
- m365 teams team archive --teamId 6f6fd3f7-9ba5-4488-bbe6-a789004d0d55
47
+ m365 teams team archive --name "Team Name"
33
48
  ```
34
49
 
35
50
  Archive the specified Microsoft Teams team and set permissions for team members to read-only on the SharePoint Online site associated with the team
36
51
 
37
52
  ```sh
38
- m365 teams team archive --teamId 6f6fd3f7-9ba5-4488-bbe6-a789004d0d55 --shouldSetSpoSiteReadOnlyForMembers
53
+ m365 teams team archive --id 6f6fd3f7-9ba5-4488-bbe6-a789004d0d55 --shouldSetSpoSiteReadOnlyForMembers
39
54
  ```
@@ -10,8 +10,14 @@ m365 teams team remove [options]
10
10
 
11
11
  ## Options
12
12
 
13
- `-i, --teamId <teamId>`
14
- : The ID of the Teams team to remove
13
+ `-i, --id [id]`
14
+ : The ID of the Microsoft Teams team to remove. Specify either id or name but not both
15
+
16
+ `-n, --name [name]`
17
+ : The display name of the Microsoft Teams team to remove. Specify either id or name but not both
18
+
19
+ `--teamId [teamId]`
20
+ : (deprecated. Use `id` instead) The ID of the Teams team to remove
15
21
 
16
22
  `--confirm`
17
23
  : Don't prompt for confirming removing the specified team
@@ -22,18 +28,26 @@ m365 teams team remove [options]
22
28
 
23
29
  When deleted, Microsoft 365 groups are moved to a temporary container and can be restored within 30 days. After that time, they are permanently deleted. This applies only to Microsoft 365 groups.
24
30
 
31
+ If the command finds multiple Microsoft Teams teams with the specified name, it will prompt you to disambiguate which team it should use, listing the discovered team IDs.
32
+
25
33
  ## Examples
26
34
 
27
- Removes the specified team
35
+ Removes the specified Microsoft Teams team with id _00000000-0000-0000-0000-000000000000_
36
+
37
+ ```sh
38
+ m365 teams team remove --id 00000000-0000-0000-0000-000000000000
39
+ ```
40
+
41
+ Removes the specified Microsoft Teams team with name _Team Name_
28
42
 
29
43
  ```sh
30
- m365 teams team remove --teamId '00000000-0000-0000-0000-000000000000'
44
+ m365 teams team remove --name "Team Name"
31
45
  ```
32
46
 
33
47
  Removes the specified team without confirmation
34
48
 
35
49
  ```sh
36
- m365 teams team remove --teamId '00000000-0000-0000-0000-000000000000' --confirm
50
+ m365 teams team remove --id 00000000-0000-0000-0000-000000000000 --confirm
37
51
  ```
38
52
 
39
53
  ## More information
@@ -10,8 +10,14 @@ m365 teams team unarchive [options]
10
10
 
11
11
  ## Options
12
12
 
13
- `-i, --teamId <teamId>`
14
- : The ID of the Microsoft Teams team to restore
13
+ `-i, --id [id]`
14
+ : The ID of the Microsoft Teams team to restore. Specify either id or name but not both
15
+
16
+ `-n, --name [name]`
17
+ : The display name of the Microsoft Teams team to restore. Specify either id or name but not both
18
+
19
+ `--teamId [teamId]`
20
+ : (deprecated. Use `id` instead) The ID of the Microsoft Teams team to restore
15
21
 
16
22
  --8<-- "docs/cmd/_global.md"
17
23
 
@@ -19,12 +25,20 @@ m365 teams team unarchive [options]
19
25
 
20
26
  This command supports admin permissions. Global admins and Microsoft Teams service admins can restore teams that they are not a member of.
21
27
 
28
+ If the command finds multiple Microsoft Teams teams with the specified name, it will prompt you to disambiguate which team it should use, listing the discovered team IDs.
29
+
22
30
  This command restores users' ability to send messages and edit the team, abiding by tenant and team settings.
23
31
 
24
32
  ## Examples
25
33
 
26
- Restore an archived Microsoft Teams team
34
+ Restore an archived Microsoft Teams team with id _6f6fd3f7-9ba5-4488-bbe6-a789004d0d55_
35
+
36
+ ```sh
37
+ m365 teams team unarchive --id 6f6fd3f7-9ba5-4488-bbe6-a789004d0d55
38
+ ```
39
+
40
+ Restore an archived Microsoft Teams team with name _Team Name_
27
41
 
28
42
  ```sh
29
- m365 teams team unarchive --teamId 6f6fd3f7-9ba5-4488-bbe6-a789004d0d55
43
+ m365 teams team unarchive --name "Team Name"
30
44
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "6.0.0-beta.3f3b164",
3
+ "version": "6.0.0-beta.4d2402f",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",