@pnp/cli-microsoft365 5.9.0-beta.60e454b → 5.9.0-beta.63e1266

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 (43) hide show
  1. package/dist/Command.js +16 -2
  2. package/dist/m365/aad/commands/app/app-add.js +37 -13
  3. package/dist/m365/commands/status.js +6 -1
  4. package/dist/m365/outlook/commands/mail/mail-send.js +54 -30
  5. package/dist/m365/pp/commands/card/card-get.js +110 -0
  6. package/dist/m365/pp/commands/gateway/gateway-get.js +70 -0
  7. package/dist/m365/pp/commands/solution/solution-get.js +117 -0
  8. package/dist/m365/pp/commands.js +3 -0
  9. package/dist/m365/spfx/commands/project/project-doctor.js +4 -1
  10. package/dist/m365/spfx/commands/project/project-externalize.js +4 -1
  11. package/dist/m365/spfx/commands/spfx-doctor.js +3 -3
  12. package/dist/m365/spo/commands/contenttype/contenttype-add.js +82 -43
  13. package/dist/m365/spo/commands/contenttype/contenttype-field-remove.js +53 -21
  14. package/dist/m365/spo/commands/contenttype/contenttype-get.js +35 -14
  15. package/dist/m365/spo/commands/list/list-roleassignment-add.js +1 -1
  16. package/dist/m365/spo/commands/list/list-roleinheritance-break.js +14 -6
  17. package/dist/m365/spo/commands/list/list-roleinheritance-reset.js +15 -7
  18. package/dist/m365/spo/commands/listitem/listitem-roleassignment-add.js +239 -0
  19. package/dist/m365/spo/commands.js +1 -0
  20. package/dist/m365/todo/commands/task/task-add.js +55 -3
  21. package/docs/docs/_clisettings.md +19 -0
  22. package/docs/docs/cmd/outlook/mail/mail-send.md +13 -0
  23. package/docs/docs/cmd/planner/bucket/bucket-add.md +29 -0
  24. package/docs/docs/cmd/planner/bucket/bucket-get.md +29 -0
  25. package/docs/docs/cmd/planner/bucket/bucket-list.md +30 -0
  26. package/docs/docs/cmd/planner/bucket/bucket-remove.md +4 -0
  27. package/docs/docs/cmd/planner/bucket/bucket-set.md +4 -0
  28. package/docs/docs/cmd/planner/plan/plan-add.md +123 -0
  29. package/docs/docs/cmd/planner/plan/plan-get.md +75 -0
  30. package/docs/docs/cmd/planner/plan/plan-list.md +45 -0
  31. package/docs/docs/cmd/planner/plan/plan-remove.md +4 -0
  32. package/docs/docs/cmd/pp/card/card-get.md +51 -0
  33. package/docs/docs/cmd/pp/gateway/gateway-get.md +24 -0
  34. package/docs/docs/cmd/pp/solution/solution-get.md +51 -0
  35. package/docs/docs/cmd/spfx/project/project-rename.md +1 -14
  36. package/docs/docs/cmd/spo/contenttype/contenttype-add.md +20 -2
  37. package/docs/docs/cmd/spo/contenttype/contenttype-field-remove.md +22 -4
  38. package/docs/docs/cmd/spo/contenttype/contenttype-get.md +21 -3
  39. package/docs/docs/cmd/spo/list/list-roleinheritance-break.md +11 -8
  40. package/docs/docs/cmd/spo/list/list-roleinheritance-reset.md +14 -5
  41. package/docs/docs/cmd/spo/listitem/listitem-roleassignment-add.md +81 -0
  42. package/docs/docs/cmd/todo/task/task-add.md +32 -5
  43. package/package.json +10 -6
@@ -449,6 +449,9 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
449
449
  __classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initOptions).call(this);
450
450
  __classPrivateFieldGet(this, _SpfxDoctorCommand_instances, "m", _SpfxDoctorCommand_initValidators).call(this);
451
451
  }
452
+ get allowedOutputs() {
453
+ return ['text'];
454
+ }
452
455
  get name() {
453
456
  return commands_1.default.DOCTOR;
454
457
  }
@@ -758,9 +761,6 @@ _SpfxDoctorCommand_instances = new WeakSet(), _SpfxDoctorCommand_initTelemetry =
758
761
  return `${args.options.spfxVersion} is not a supported SharePoint Framework version. Supported versions are ${Object.keys(this.versions).join(', ')}`;
759
762
  }
760
763
  }
761
- if (args.options.output && args.options.output !== 'text') {
762
- return `The output option only accepts the type 'text'`;
763
- }
764
764
  return true;
765
765
  }));
766
766
  };
@@ -20,6 +20,7 @@ const config_1 = require("../../../../config");
20
20
  const request_1 = require("../../../../request");
21
21
  const formatting_1 = require("../../../../utils/formatting");
22
22
  const spo_1 = require("../../../../utils/spo");
23
+ const urlUtil_1 = require("../../../../utils/urlUtil");
23
24
  const validation_1 = require("../../../../utils/validation");
24
25
  const SpoCommand_1 = require("../../../base/SpoCommand");
25
26
  const commands_1 = require("../../commands");
@@ -42,7 +43,13 @@ class SpoContentTypeAddCommand extends SpoCommand_1.default {
42
43
  commandAction(logger, args) {
43
44
  return __awaiter(this, void 0, void 0, function* () {
44
45
  try {
45
- const parentInfo = yield this.getParentInfo(args.options.listTitle, args.options.webUrl, logger);
46
+ let parentInfo = '';
47
+ if (!args.options.listId && !args.options.listTitle && !args.options.listUrl) {
48
+ parentInfo = '<Property Id="5" ParentId="3" Name="Web" /><StaticProperty Id="3" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" />';
49
+ }
50
+ else {
51
+ parentInfo = yield this.getParentInfo(args.options, logger);
52
+ }
46
53
  if (this.verbose) {
47
54
  logger.logToStderr(`Retrieving request digest...`);
48
55
  }
@@ -69,6 +76,8 @@ class SpoContentTypeAddCommand extends SpoCommand_1.default {
69
76
  const options = {
70
77
  webUrl: args.options.webUrl,
71
78
  listTitle: args.options.listTitle,
79
+ listUrl: args.options.listUrl,
80
+ listId: args.options.listId,
72
81
  id: args.options.id,
73
82
  output: 'json',
74
83
  debug: this.debug,
@@ -90,60 +99,79 @@ class SpoContentTypeAddCommand extends SpoCommand_1.default {
90
99
  }
91
100
  });
92
101
  }
93
- getParentInfo(listTitle, webUrl, logger) {
94
- return new Promise((resolve, reject) => {
95
- if (!listTitle) {
96
- resolve('<Property Id="5" ParentId="3" Name="Web" /><StaticProperty Id="3" TypeId="{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}" Name="Current" />');
97
- return;
102
+ getParentInfo(options, logger) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ const siteId = yield this.getSiteId(options.webUrl, logger);
105
+ const webId = yield this.getWebId(options.webUrl, logger);
106
+ const listId = yield this.getListId(options, logger);
107
+ return `<Identity Id="5" Name="1a48869e-c092-0000-1f61-81ec89809537|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:web:${webId}:list:${listId}" />`;
108
+ });
109
+ }
110
+ getSiteId(webUrl, logger) {
111
+ return __awaiter(this, void 0, void 0, function* () {
112
+ if (this.verbose) {
113
+ logger.logToStderr(`Retrieving site collection id...`);
98
114
  }
99
- let siteId = '';
100
- let webId = '';
101
- (() => {
102
- if (this.verbose) {
103
- logger.logToStderr(`Retrieving site collection id...`);
104
- }
105
- const requestOptions = {
106
- url: `${webUrl}/_api/site?$select=Id`,
107
- headers: {
108
- accept: 'application/json;odata=nometadata'
109
- },
110
- responseType: 'json'
111
- };
112
- return request_1.default.get(requestOptions);
113
- })()
114
- .then((res) => {
115
- siteId = res.Id;
116
- if (this.verbose) {
117
- logger.logToStderr(`Retrieving site id...`);
118
- }
115
+ const requestOptions = {
116
+ url: `${webUrl}/_api/site?$select=Id`,
117
+ headers: {
118
+ accept: 'application/json;odata=nometadata'
119
+ },
120
+ responseType: 'json'
121
+ };
122
+ const siteResponse = yield request_1.default.get(requestOptions);
123
+ return siteResponse.Id;
124
+ });
125
+ }
126
+ getWebId(webUrl, logger) {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ if (this.verbose) {
129
+ logger.logToStderr(`Retrieving web id...`);
130
+ }
131
+ const requestOptions = {
132
+ url: `${webUrl}/_api/web?$select=Id`,
133
+ headers: {
134
+ accept: 'application/json;odata=nometadata'
135
+ },
136
+ responseType: 'json'
137
+ };
138
+ const webResponse = yield request_1.default.get(requestOptions);
139
+ return webResponse.Id;
140
+ });
141
+ }
142
+ getListId(options, logger) {
143
+ return __awaiter(this, void 0, void 0, function* () {
144
+ if (this.verbose) {
145
+ logger.logToStderr(`Retrieving list id...`);
146
+ }
147
+ let listId = '';
148
+ if (options.listId) {
149
+ return options.listId;
150
+ }
151
+ else if (options.listTitle) {
119
152
  const requestOptions = {
120
- url: `${webUrl}/_api/web?$select=Id`,
153
+ url: `${options.webUrl}/_api/web/lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(options.listTitle)}')?$select=Id`,
121
154
  headers: {
122
155
  accept: 'application/json;odata=nometadata'
123
156
  },
124
157
  responseType: 'json'
125
158
  };
126
- return request_1.default.get(requestOptions);
127
- })
128
- .then((res) => {
129
- webId = res.Id;
130
- if (this.verbose) {
131
- logger.logToStderr(`Retrieving list id...`);
132
- }
159
+ const listResponse = yield request_1.default.get(requestOptions);
160
+ listId = listResponse.Id;
161
+ }
162
+ else if (options.listUrl) {
163
+ const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(options.webUrl, options.listUrl);
133
164
  const requestOptions = {
134
- url: `${webUrl}/_api/web/lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(listTitle)}')?$select=Id`,
165
+ url: `${options.webUrl}/_api/web/GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')?$select=Id`,
135
166
  headers: {
136
167
  accept: 'application/json;odata=nometadata'
137
168
  },
138
169
  responseType: 'json'
139
170
  };
140
- return request_1.default.get(requestOptions);
141
- })
142
- .then((res) => {
143
- resolve(`<Identity Id="5" Name="1a48869e-c092-0000-1f61-81ec89809537|740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:${siteId}:web:${webId}:list:${res.Id}" />`);
144
- }, (error) => {
145
- reject(error);
146
- });
171
+ const listResponse = yield request_1.default.get(requestOptions);
172
+ listId = listResponse.Id;
173
+ }
174
+ return listId;
147
175
  });
148
176
  }
149
177
  }
@@ -160,6 +188,10 @@ _SpoContentTypeAddCommand_instances = new WeakSet(), _SpoContentTypeAddCommand_i
160
188
  option: '-u, --webUrl <webUrl>'
161
189
  }, {
162
190
  option: '-l, --listTitle [listTitle]'
191
+ }, {
192
+ option: '--listId [listId]'
193
+ }, {
194
+ option: '--listUrl [listUrl]'
163
195
  }, {
164
196
  option: '-i, --id <id>'
165
197
  }, {
@@ -170,7 +202,14 @@ _SpoContentTypeAddCommand_instances = new WeakSet(), _SpoContentTypeAddCommand_i
170
202
  option: '-g, --group [group]'
171
203
  });
172
204
  }, _SpoContentTypeAddCommand_initValidators = function _SpoContentTypeAddCommand_initValidators() {
173
- this.validators.push((args) => __awaiter(this, void 0, void 0, function* () { return validation_1.validation.isValidSharePointUrl(args.options.webUrl); }));
205
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
206
+ if (args.options.listId) {
207
+ if (!validation_1.validation.isValidGuid(args.options.listId)) {
208
+ return `${args.options.listId} is not a valid GUID`;
209
+ }
210
+ }
211
+ return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
212
+ }));
174
213
  }, _SpoContentTypeAddCommand_initTypes = function _SpoContentTypeAddCommand_initTypes() {
175
214
  this.types.string.push('id', 'i');
176
215
  };
@@ -19,6 +19,7 @@ const Cli_1 = require("../../../../cli/Cli");
19
19
  const request_1 = require("../../../../request");
20
20
  const formatting_1 = require("../../../../utils/formatting");
21
21
  const spo_1 = require("../../../../utils/spo");
22
+ const urlUtil_1 = require("../../../../utils/urlUtil");
22
23
  const validation_1 = require("../../../../utils/validation");
23
24
  const SpoCommand_1 = require("../../../base/SpoCommand");
24
25
  const commands_1 = require("../../commands");
@@ -72,30 +73,25 @@ class SpoContentTypeFieldRemoveCommand extends SpoCommand_1.default {
72
73
  logger.logToStderr(`WebId: ${webId}`);
73
74
  }
74
75
  let listId = undefined;
75
- // If ListTitle is provided
76
- if (args.options.listTitle) {
77
- // Request for the ListId
78
- const requestOptions = {
79
- url: `${args.options.webUrl}/_api/lists/GetByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')?$select=Id`,
80
- headers: {
81
- accept: 'application/json;odata=nometadata'
82
- },
83
- responseType: 'json'
84
- };
85
- const list = yield request_1.default.get(requestOptions);
86
- listId = list.Id;
87
- if (this.debug) {
88
- logger.logToStderr(`ListId: ${listId}`);
89
- }
76
+ if (args.options.listId) {
77
+ listId = args.options.listId;
78
+ }
79
+ else if (args.options.listTitle) {
80
+ listId = yield this.getListIdFromListTitle(args.options.webUrl, args.options.listTitle);
81
+ }
82
+ else if (args.options.listUrl) {
83
+ listId = yield this.getListIdFromListUrl(args.options.webUrl, args.options.listUrl);
84
+ }
85
+ if (this.debug) {
86
+ logger.logToStderr(`ListId: ${listId}`);
90
87
  }
91
88
  const reqDigest = yield spo_1.spo.getRequestDigest(args.options.webUrl);
92
89
  const requestDigest = reqDigest.FormDigestValue;
93
- const updateChildContentTypes = args.options.listTitle ? false : args.options.updateChildContentTypes === true;
90
+ const updateChildContentTypes = args.options.listTitle || args.options.listId || args.options.listUrl ? false : args.options.updateChildContentTypes === true;
94
91
  if (this.debug) {
95
- const additionalLog = args.options.listTitle ? `; ListTitle='${args.options.listTitle}'` : ` ; UpdateChildContentTypes='${updateChildContentTypes}`;
92
+ const additionalLog = args.options.listTitle ? `; ListTitle='${args.options.listTitle}'` : args.options.listId ? `; ListId='${args.options.listId}'` : args.options.listUrl ? `; ListUrl='${args.options.listUrl}'` : ` ; UpdateChildContentTypes='${updateChildContentTypes}`;
96
93
  logger.logToStderr(`Remove FieldLink from ContentType. FieldLinkId='${args.options.fieldLinkId}' ; ContentTypeId='${args.options.contentTypeId}' ${additionalLog}`);
97
94
  logger.logToStderr(`Execute ProcessQuery.`);
98
- logger.logToStderr('');
99
95
  }
100
96
  let requestBody = '';
101
97
  if (listId) {
@@ -138,13 +134,42 @@ class SpoContentTypeFieldRemoveCommand extends SpoCommand_1.default {
138
134
  }
139
135
  });
140
136
  }
137
+ getListIdFromListTitle(webUrl, listTitle) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ const requestOptions = {
140
+ url: `${webUrl}/_api/lists/GetByTitle('${formatting_1.formatting.encodeQueryParameter(listTitle)}')?$select=Id`,
141
+ headers: {
142
+ accept: 'application/json;odata=nometadata'
143
+ },
144
+ responseType: 'json'
145
+ };
146
+ const list = yield request_1.default.get(requestOptions);
147
+ return list.Id;
148
+ });
149
+ }
150
+ getListIdFromListUrl(webUrl, listUrl) {
151
+ return __awaiter(this, void 0, void 0, function* () {
152
+ const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(webUrl, listUrl);
153
+ const requestOptions = {
154
+ url: `${webUrl}/_api/web/GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')?$select=Id`,
155
+ headers: {
156
+ accept: 'application/json;odata=nometadata'
157
+ },
158
+ responseType: 'json'
159
+ };
160
+ const list = yield request_1.default.get(requestOptions);
161
+ return list.Id;
162
+ });
163
+ }
141
164
  }
142
165
  _SpoContentTypeFieldRemoveCommand_instances = new WeakSet(), _SpoContentTypeFieldRemoveCommand_initTelemetry = function _SpoContentTypeFieldRemoveCommand_initTelemetry() {
143
166
  this.telemetry.push((args) => {
144
167
  Object.assign(this.telemetryProperties, {
145
- listTitle: (!(!args.options.listTitle)).toString(),
146
- updateChildContentTypes: (!(!args.options.updateChildContentTypes)).toString(),
147
- confirm: (!(!args.options.confirm)).toString()
168
+ listTitle: typeof args.options.listTitle !== 'undefined',
169
+ listId: typeof args.options.listId !== 'undefined',
170
+ listUrl: typeof args.options.listUrl !== 'undefined',
171
+ updateChildContentTypes: !!args.options.updateChildContentTypes,
172
+ confirm: !!args.options.confirm
148
173
  });
149
174
  });
150
175
  }, _SpoContentTypeFieldRemoveCommand_initOptions = function _SpoContentTypeFieldRemoveCommand_initOptions() {
@@ -152,6 +177,10 @@ _SpoContentTypeFieldRemoveCommand_instances = new WeakSet(), _SpoContentTypeFiel
152
177
  option: '-u, --webUrl <webUrl>'
153
178
  }, {
154
179
  option: '-l, --listTitle [listTitle]'
180
+ }, {
181
+ option: '--listId [listId]'
182
+ }, {
183
+ option: '--listUrl [listUrl]'
155
184
  }, {
156
185
  option: '-i, --contentTypeId <contentTypeId>'
157
186
  }, {
@@ -166,6 +195,9 @@ _SpoContentTypeFieldRemoveCommand_instances = new WeakSet(), _SpoContentTypeFiel
166
195
  if (!validation_1.validation.isValidGuid(args.options.fieldLinkId)) {
167
196
  return `${args.options.fieldLinkId} is not a valid GUID`;
168
197
  }
198
+ if (args.options.listId && !validation_1.validation.isValidGuid(args.options.listId)) {
199
+ return `${args.options.listId} is not a valid GUID`;
200
+ }
169
201
  return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
170
202
  }));
171
203
  }, _SpoContentTypeFieldRemoveCommand_initTypes = function _SpoContentTypeFieldRemoveCommand_initTypes() {
@@ -17,6 +17,7 @@ var _SpoContentTypeGetCommand_instances, _SpoContentTypeGetCommand_initTelemetry
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const formatting_1 = require("../../../../utils/formatting");
20
+ const urlUtil_1 = require("../../../../utils/urlUtil");
20
21
  const validation_1 = require("../../../../utils/validation");
21
22
  const SpoCommand_1 = require("../../../base/SpoCommand");
22
23
  const commands_1 = require("../../commands");
@@ -38,21 +39,32 @@ class SpoContentTypeGetCommand extends SpoCommand_1.default {
38
39
  }
39
40
  commandAction(logger, args) {
40
41
  return __awaiter(this, void 0, void 0, function* () {
42
+ let requestUrl = `${args.options.webUrl}/_api/web`;
43
+ if (args.options.listId) {
44
+ requestUrl += `/lists(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')`;
45
+ }
46
+ else if (args.options.listTitle) {
47
+ requestUrl += `/lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
48
+ }
49
+ else if (args.options.listUrl) {
50
+ const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
51
+ requestUrl += `/GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')`;
52
+ }
53
+ requestUrl += "/contenttypes";
54
+ if (args.options.id) {
55
+ requestUrl += `('${encodeURIComponent(args.options.id)}')`;
56
+ }
57
+ else if (args.options.name) {
58
+ requestUrl += `?$filter=Name eq '${encodeURIComponent(args.options.name)}'`;
59
+ }
60
+ const requestOptions = {
61
+ url: requestUrl,
62
+ headers: {
63
+ accept: 'application/json;odata=nometadata'
64
+ },
65
+ responseType: 'json'
66
+ };
41
67
  try {
42
- let requestUrl = `${args.options.webUrl}/_api/web/${(args.options.listTitle ? `lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')/` : '')}contenttypes`;
43
- if (args.options.id) {
44
- requestUrl += `('${encodeURIComponent(args.options.id)}')`;
45
- }
46
- else if (args.options.name) {
47
- requestUrl += `?$filter=Name eq '${encodeURIComponent(args.options.name)}'`;
48
- }
49
- const requestOptions = {
50
- url: requestUrl,
51
- headers: {
52
- accept: 'application/json;odata=nometadata'
53
- },
54
- responseType: 'json'
55
- };
56
68
  let res = yield request_1.default.get(requestOptions);
57
69
  let errorMessage = '';
58
70
  if (args.options.name) {
@@ -80,7 +92,9 @@ class SpoContentTypeGetCommand extends SpoCommand_1.default {
80
92
  _SpoContentTypeGetCommand_instances = new WeakSet(), _SpoContentTypeGetCommand_initTelemetry = function _SpoContentTypeGetCommand_initTelemetry() {
81
93
  this.telemetry.push((args) => {
82
94
  Object.assign(this.telemetryProperties, {
95
+ listId: typeof args.options.listId !== 'undefined',
83
96
  listTitle: typeof args.options.listTitle !== 'undefined',
97
+ listUrl: typeof args.options.listUrl !== 'undefined',
84
98
  id: typeof args.options.id !== 'undefined',
85
99
  name: typeof args.options.name !== 'undefined'
86
100
  });
@@ -90,6 +104,10 @@ _SpoContentTypeGetCommand_instances = new WeakSet(), _SpoContentTypeGetCommand_i
90
104
  option: '-u, --webUrl <webUrl>'
91
105
  }, {
92
106
  option: '-l, --listTitle [listTitle]'
107
+ }, {
108
+ option: '--listId [listId]'
109
+ }, {
110
+ option: '--listUrl [listUrl]'
93
111
  }, {
94
112
  option: '-i, --id [id]'
95
113
  }, {
@@ -101,6 +119,9 @@ _SpoContentTypeGetCommand_instances = new WeakSet(), _SpoContentTypeGetCommand_i
101
119
  if (isValidSharePointUrl !== true) {
102
120
  return isValidSharePointUrl;
103
121
  }
122
+ if (args.options.listId && !validation_1.validation.isValidGuid(args.options.listId)) {
123
+ return `${args.options.listId} is not a valid GUID`;
124
+ }
104
125
  return true;
105
126
  }));
106
127
  }, _SpoContentTypeGetCommand_initTypes = function _SpoContentTypeGetCommand_initTypes() {
@@ -63,7 +63,7 @@ class SpoListRoleAssignmentAddCommand extends SpoCommand_1.default {
63
63
  }
64
64
  else if (args.options.groupName) {
65
65
  args.options.principalId = yield this.getGroupPrincipalId(args.options);
66
- this.addRoleAssignment(requestUrl, logger, args.options);
66
+ yield this.addRoleAssignment(requestUrl, logger, args.options);
67
67
  }
68
68
  else {
69
69
  yield this.addRoleAssignment(requestUrl, logger, args.options);
@@ -17,6 +17,7 @@ var _SpoListRoleInheritanceBreakCommand_instances, _SpoListRoleInheritanceBreakC
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const formatting_1 = require("../../../../utils/formatting");
20
+ const urlUtil_1 = require("../../../../utils/urlUtil");
20
21
  const validation_1 = require("../../../../utils/validation");
21
22
  const SpoCommand_1 = require("../../../base/SpoCommand");
22
23
  const commands_1 = require("../../commands");
@@ -40,19 +41,23 @@ class SpoListRoleInheritanceBreakCommand extends SpoCommand_1.default {
40
41
  if (this.verbose) {
41
42
  logger.logToStderr(`Breaking role inheritance of list in site at ${args.options.webUrl}...`);
42
43
  }
43
- let requestUrl = `${args.options.webUrl}/_api/web/lists`;
44
+ let requestUrl = `${args.options.webUrl}/_api/web/`;
44
45
  if (args.options.listId) {
45
- requestUrl += `(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')`;
46
+ requestUrl += `lists(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
46
47
  }
47
- else {
48
- requestUrl += `/getbytitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
48
+ else if (args.options.listTitle) {
49
+ requestUrl += `lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')/`;
50
+ }
51
+ else if (args.options.listUrl) {
52
+ const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
53
+ requestUrl += `GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
49
54
  }
50
55
  let keepExistingPermissions = true;
51
56
  if (args.options.clearExistingPermissions) {
52
57
  keepExistingPermissions = !args.options.clearExistingPermissions;
53
58
  }
54
59
  const requestOptions = {
55
- url: `${requestUrl}/breakroleinheritance(${keepExistingPermissions})`,
60
+ url: `${requestUrl}breakroleinheritance(${keepExistingPermissions})`,
56
61
  method: 'POST',
57
62
  headers: {
58
63
  'accept': 'application/json;odata=nometadata',
@@ -74,6 +79,7 @@ _SpoListRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoListRoleInher
74
79
  Object.assign(this.telemetryProperties, {
75
80
  listId: typeof args.options.listId !== 'undefined',
76
81
  listTitle: typeof args.options.listTitle !== 'undefined',
82
+ listUrl: typeof args.options.listUrl !== 'undefined',
77
83
  clearExistingPermissions: args.options.clearExistingPermissions === true
78
84
  });
79
85
  });
@@ -84,6 +90,8 @@ _SpoListRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoListRoleInher
84
90
  option: '-i, --listId [listId]'
85
91
  }, {
86
92
  option: '-t, --listTitle [listTitle]'
93
+ }, {
94
+ option: '--listUrl [listUrl]'
87
95
  }, {
88
96
  option: '-c, --clearExistingPermissions'
89
97
  });
@@ -99,7 +107,7 @@ _SpoListRoleInheritanceBreakCommand_instances = new WeakSet(), _SpoListRoleInher
99
107
  return true;
100
108
  }));
101
109
  }, _SpoListRoleInheritanceBreakCommand_initOptionSets = function _SpoListRoleInheritanceBreakCommand_initOptionSets() {
102
- this.optionSets.push(['listId', 'listTitle']);
110
+ this.optionSets.push(['listId', 'listTitle', 'listUrl']);
103
111
  };
104
112
  module.exports = new SpoListRoleInheritanceBreakCommand();
105
113
  //# sourceMappingURL=list-roleinheritance-break.js.map
@@ -17,6 +17,7 @@ var _SpoListRoleInheritanceResetCommand_instances, _SpoListRoleInheritanceResetC
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const formatting_1 = require("../../../../utils/formatting");
20
+ const urlUtil_1 = require("../../../../utils/urlUtil");
20
21
  const validation_1 = require("../../../../utils/validation");
21
22
  const SpoCommand_1 = require("../../../base/SpoCommand");
22
23
  const commands_1 = require("../../commands");
@@ -40,15 +41,19 @@ class SpoListRoleInheritanceResetCommand extends SpoCommand_1.default {
40
41
  if (this.verbose) {
41
42
  logger.logToStderr(`Restore role inheritance of list in site at ${args.options.webUrl}...`);
42
43
  }
43
- let requestUrl = `${args.options.webUrl}/_api/web/lists`;
44
+ let requestUrl = `${args.options.webUrl}/_api/web/`;
44
45
  if (args.options.listId) {
45
- requestUrl += `(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')`;
46
+ requestUrl += `lists(guid'${formatting_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
46
47
  }
47
- else {
48
- requestUrl += `/getbytitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')`;
48
+ else if (args.options.listTitle) {
49
+ requestUrl += `lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(args.options.listTitle)}')/`;
50
+ }
51
+ else if (args.options.listUrl) {
52
+ const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(args.options.webUrl, args.options.listUrl);
53
+ requestUrl += `GetList('${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}')/`;
49
54
  }
50
55
  const requestOptions = {
51
- url: `${requestUrl}/resetroleinheritance`,
56
+ url: `${requestUrl}resetroleinheritance`,
52
57
  method: 'POST',
53
58
  headers: {
54
59
  'accept': 'application/json;odata=nometadata',
@@ -69,7 +74,8 @@ _SpoListRoleInheritanceResetCommand_instances = new WeakSet(), _SpoListRoleInher
69
74
  this.telemetry.push((args) => {
70
75
  Object.assign(this.telemetryProperties, {
71
76
  listId: typeof args.options.listId !== 'undefined',
72
- listTitle: typeof args.options.listTitle !== 'undefined'
77
+ listTitle: typeof args.options.listTitle !== 'undefined',
78
+ listUrl: typeof args.options.listUrl !== 'undefined'
73
79
  });
74
80
  });
75
81
  }, _SpoListRoleInheritanceResetCommand_initOptions = function _SpoListRoleInheritanceResetCommand_initOptions() {
@@ -79,6 +85,8 @@ _SpoListRoleInheritanceResetCommand_instances = new WeakSet(), _SpoListRoleInher
79
85
  option: '-i, --listId [listId]'
80
86
  }, {
81
87
  option: '-t, --listTitle [listTitle]'
88
+ }, {
89
+ option: '--listUrl [listUrl]'
82
90
  });
83
91
  }, _SpoListRoleInheritanceResetCommand_initValidators = function _SpoListRoleInheritanceResetCommand_initValidators() {
84
92
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
@@ -92,7 +100,7 @@ _SpoListRoleInheritanceResetCommand_instances = new WeakSet(), _SpoListRoleInher
92
100
  return true;
93
101
  }));
94
102
  }, _SpoListRoleInheritanceResetCommand_initOptionSets = function _SpoListRoleInheritanceResetCommand_initOptionSets() {
95
- this.optionSets.push(['listId', 'listTitle']);
103
+ this.optionSets.push(['listId', 'listTitle', 'listUrl']);
96
104
  };
97
105
  module.exports = new SpoListRoleInheritanceResetCommand();
98
106
  //# sourceMappingURL=list-roleinheritance-reset.js.map