@pnp/cli-microsoft365 6.1.0-beta.17b053d → 6.1.0-beta.240d88d

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 (63) hide show
  1. package/dist/m365/aad/commands/user/user-set.js +84 -11
  2. package/dist/m365/base/ContextCommand.js +33 -0
  3. package/dist/m365/context/commands/context-init.js +28 -0
  4. package/dist/m365/context/commands.js +7 -0
  5. package/dist/m365/spo/commands/list/{list-label-get.js → list-retentionlabel-get.js} +19 -15
  6. package/dist/m365/spo/commands/list/{list-label-set.js → list-retentionlabel-set.js} +19 -15
  7. package/dist/m365/spo/commands/web/web-retentionlabel-list.js +63 -0
  8. package/dist/m365/spo/commands.js +3 -0
  9. package/docs/docs/cmd/aad/user/user-set.md +31 -3
  10. package/docs/docs/cmd/context/context-init.md +25 -0
  11. package/docs/docs/cmd/spo/list/{list-label-get.md → list-retentionlabel-get.md} +17 -11
  12. package/docs/docs/cmd/spo/list/list-retentionlabel-set.md +65 -0
  13. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-add.md +9 -5
  14. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-list.md +42 -0
  15. package/docs/docs/cmd/spo/orgassetslibrary/orgassetslibrary-remove.md +25 -3
  16. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-list.md +22 -0
  17. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-remove.md +6 -2
  18. package/docs/docs/cmd/spo/orgnewssite/orgnewssite-set.md +5 -1
  19. package/docs/docs/cmd/spo/page/page-add.md +13 -9
  20. package/docs/docs/cmd/spo/page/page-clientsidewebpart-add.md +6 -2
  21. package/docs/docs/cmd/spo/page/page-column-get.md +68 -5
  22. package/docs/docs/cmd/spo/page/page-column-list.md +36 -4
  23. package/docs/docs/cmd/spo/page/page-control-get.md +70 -3
  24. package/docs/docs/cmd/spo/page/page-control-list.md +69 -3
  25. package/docs/docs/cmd/spo/page/page-control-set.md +11 -7
  26. package/docs/docs/cmd/spo/page/page-copy.md +65 -4
  27. package/docs/docs/cmd/spo/page/page-get.md +100 -4
  28. package/docs/docs/cmd/spo/page/page-header-set.md +17 -13
  29. package/docs/docs/cmd/spo/page/page-list.md +122 -1
  30. package/docs/docs/cmd/spo/page/page-remove.md +9 -5
  31. package/docs/docs/cmd/spo/page/page-section-add.md +10 -6
  32. package/docs/docs/cmd/spo/page/page-section-get.md +36 -4
  33. package/docs/docs/cmd/spo/page/page-section-list.md +38 -3
  34. package/docs/docs/cmd/spo/page/page-set.md +10 -10
  35. package/docs/docs/cmd/spo/page/page-template-list.md +58 -1
  36. package/docs/docs/cmd/spo/page/page-text-add.md +9 -5
  37. package/docs/docs/cmd/spo/propertybag/propertybag-get.md +28 -8
  38. package/docs/docs/cmd/spo/propertybag/propertybag-list.md +35 -7
  39. package/docs/docs/cmd/spo/propertybag/propertybag-remove.md +13 -9
  40. package/docs/docs/cmd/spo/propertybag/propertybag-set.md +13 -5
  41. package/docs/docs/cmd/spo/report/report-activityfilecounts.md +34 -2
  42. package/docs/docs/cmd/spo/report/report-activitypages.md +31 -2
  43. package/docs/docs/cmd/spo/report/report-activityusercounts.md +35 -2
  44. package/docs/docs/cmd/spo/report/report-activityuserdetail.md +40 -3
  45. package/docs/docs/cmd/spo/report/report-siteusagedetail.md +43 -3
  46. package/docs/docs/cmd/spo/report/report-siteusagefilecounts.md +33 -2
  47. package/docs/docs/cmd/spo/report/report-siteusagepages.md +32 -2
  48. package/docs/docs/cmd/spo/report/report-siteusagesitecounts.md +33 -2
  49. package/docs/docs/cmd/spo/report/report-siteusagestorage.md +32 -2
  50. package/docs/docs/cmd/spo/roledefinition/roledefinition-add.md +10 -6
  51. package/docs/docs/cmd/spo/roledefinition/roledefinition-get.md +80 -2
  52. package/docs/docs/cmd/spo/roledefinition/roledefinition-list.md +76 -2
  53. package/docs/docs/cmd/spo/roledefinition/roledefinition-remove.md +9 -5
  54. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-add.md +39 -2
  55. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-list.md +32 -0
  56. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-grant-revoke.md +6 -2
  57. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-permissionrequest-approve.md +14 -74
  58. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-permissionrequest-deny.md +6 -2
  59. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-permissionrequest-list.md +30 -0
  60. package/docs/docs/cmd/spo/serviceprincipal/serviceprincipal-set.md +36 -2
  61. package/docs/docs/cmd/spo/web/web-retentionlabel-list.md +74 -0
  62. package/package.json +1 -1
  63. package/docs/docs/cmd/spo/list/list-label-set.md +0 -55
@@ -15,7 +15,9 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
15
15
  };
16
16
  var _AadUserSetCommand_instances, _AadUserSetCommand_initTelemetry, _AadUserSetCommand_initOptions, _AadUserSetCommand_initTypes, _AadUserSetCommand_initValidators, _AadUserSetCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
+ const Auth_1 = require("../../../../Auth");
18
19
  const request_1 = require("../../../../request");
20
+ const accessToken_1 = require("../../../../utils/accessToken");
19
21
  const formatting_1 = require("../../../../utils/formatting");
20
22
  const validation_1 = require("../../../../utils/validation");
21
23
  const GraphCommand_1 = require("../../../base/GraphCommand");
@@ -42,16 +44,36 @@ class AadUserSetCommand extends GraphCommand_1.default {
42
44
  commandAction(logger, args) {
43
45
  return __awaiter(this, void 0, void 0, function* () {
44
46
  try {
47
+ if (this.verbose) {
48
+ logger.logToStderr(`Updating user ${args.options.userPrincipalName || args.options.objectId}`);
49
+ }
50
+ if (args.options.currentPassword) {
51
+ if (args.options.objectId && args.options.objectId !== accessToken_1.accessToken.getUserIdFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken)) {
52
+ throw `You can only change your own password. Please use --objectId @meId to reference to your own userId`;
53
+ }
54
+ else if (args.options.userPrincipalName && args.options.userPrincipalName.toLowerCase() !== accessToken_1.accessToken.getUserNameFromAccessToken(Auth_1.default.service.accessTokens[Auth_1.default.defaultResource].accessToken).toLowerCase()) {
55
+ throw 'You can only change your own password. Please use --userPrincipalName @meUserName to reference to your own user principal name';
56
+ }
57
+ }
58
+ const requestUrl = `${this.resource}/v1.0/users/${formatting_1.formatting.encodeQueryParameter(args.options.objectId ? args.options.objectId : args.options.userPrincipalName)}`;
45
59
  const manifest = this.mapRequestBody(args.options);
46
- const requestOptions = {
47
- url: `${this.resource}/v1.0/users/${formatting_1.formatting.encodeQueryParameter(args.options.objectId ? args.options.objectId : args.options.userPrincipalName)}`,
48
- headers: {
49
- accept: 'application/json'
50
- },
51
- responseType: 'json',
52
- data: manifest
53
- };
54
- yield request_1.default.patch(requestOptions);
60
+ if (Object.keys(manifest).length > 0) {
61
+ if (this.verbose) {
62
+ logger.logToStderr(`Setting the updated properties for the user ${args.options.userPrincipalName || args.options.objectId}`);
63
+ }
64
+ const requestOptions = {
65
+ url: requestUrl,
66
+ headers: {
67
+ accept: 'application/json'
68
+ },
69
+ responseType: 'json',
70
+ data: manifest
71
+ };
72
+ yield request_1.default.patch(requestOptions);
73
+ }
74
+ if (args.options.currentPassword) {
75
+ yield this.changePassword(requestUrl, args.options, logger);
76
+ }
55
77
  }
56
78
  catch (err) {
57
79
  this.handleRejectedODataJsonPromise(err);
@@ -68,7 +90,11 @@ class AadUserSetCommand extends GraphCommand_1.default {
68
90
  'i',
69
91
  'userPrincipalName',
70
92
  'n',
71
- 'accountEnabled'
93
+ 'resetPassword',
94
+ 'accountEnabled',
95
+ 'currentPassword',
96
+ 'newPassword',
97
+ 'forceChangePasswordNextSignIn'
72
98
  ];
73
99
  if (options.accountEnabled !== undefined) {
74
100
  requestBody['AccountEnabled'] = options.accountEnabled;
@@ -78,15 +104,45 @@ class AadUserSetCommand extends GraphCommand_1.default {
78
104
  requestBody[key] = `${options[key]}`;
79
105
  }
80
106
  });
107
+ if (options.resetPassword) {
108
+ requestBody.passwordProfile = {
109
+ forceChangePasswordNextSignIn: options.forceChangePasswordNextSignIn || false,
110
+ password: options.newPassword
111
+ };
112
+ }
81
113
  return requestBody;
82
114
  }
115
+ changePassword(requestUrl, options, logger) {
116
+ return __awaiter(this, void 0, void 0, function* () {
117
+ if (this.verbose) {
118
+ logger.logToStderr(`Changing password for user ${options.userPrincipalName || options.objectId}`);
119
+ }
120
+ const requestBody = {
121
+ currentPassword: options.currentPassword,
122
+ newPassword: options.newPassword
123
+ };
124
+ const requestOptions = {
125
+ url: `${requestUrl}/changePassword`,
126
+ headers: {
127
+ accept: 'application/json;odata.metadata=none'
128
+ },
129
+ responseType: 'json',
130
+ data: requestBody
131
+ };
132
+ yield request_1.default.post(requestOptions);
133
+ });
134
+ }
83
135
  }
84
136
  _AadUserSetCommand_instances = new WeakSet(), _AadUserSetCommand_initTelemetry = function _AadUserSetCommand_initTelemetry() {
85
137
  this.telemetry.push((args) => {
86
138
  Object.assign(this.telemetryProperties, {
87
139
  objectId: typeof args.options.objectId !== 'undefined',
88
140
  userPrincipalName: typeof args.options.userPrincipalName !== 'undefined',
89
- accountEnabled: args.options.accountEnabled
141
+ accountEnabled: !!args.options.accountEnabled,
142
+ resetPassword: !!args.options.resetPassword,
143
+ forceChangePasswordNextSignIn: !!args.options.forceChangePasswordNextSignIn,
144
+ currentPassword: typeof args.options.currentPassword !== 'undefined',
145
+ newPassword: typeof args.options.newPassword !== 'undefined'
90
146
  });
91
147
  });
92
148
  }, _AadUserSetCommand_initOptions = function _AadUserSetCommand_initOptions() {
@@ -97,6 +153,14 @@ _AadUserSetCommand_instances = new WeakSet(), _AadUserSetCommand_initTelemetry =
97
153
  }, {
98
154
  option: '--accountEnabled [accountEnabled]',
99
155
  autocomplete: ['true', 'false']
156
+ }, {
157
+ option: '--resetPassword'
158
+ }, {
159
+ option: '--forceChangePasswordNextSignIn'
160
+ }, {
161
+ option: '--currentPassword [currentPassword]'
162
+ }, {
163
+ option: '--newPassword [newPassword]'
100
164
  });
101
165
  }, _AadUserSetCommand_initTypes = function _AadUserSetCommand_initTypes() {
102
166
  this.types.boolean.push('accountEnabled');
@@ -106,6 +170,15 @@ _AadUserSetCommand_instances = new WeakSet(), _AadUserSetCommand_initTelemetry =
106
170
  !validation_1.validation.isValidGuid(args.options.objectId)) {
107
171
  return `${args.options.objectId} is not a valid GUID`;
108
172
  }
173
+ if (!args.options.resetPassword && ((args.options.currentPassword && !args.options.newPassword) || (args.options.newPassword && !args.options.currentPassword))) {
174
+ return `Specify both currentPassword and newPassword when you want to change your password`;
175
+ }
176
+ if (args.options.resetPassword && args.options.currentPassword) {
177
+ return `When resetting a user's password, don't specify the current password`;
178
+ }
179
+ if (args.options.resetPassword && !args.options.newPassword) {
180
+ return `When resetting a user's password, specify the new password to set for the user, using the newPassword option`;
181
+ }
109
182
  return true;
110
183
  }));
111
184
  }, _AadUserSetCommand_initOptionSets = function _AadUserSetCommand_initOptionSets() {
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const fs = require("fs");
4
+ const Command_1 = require("../../Command");
5
+ const AnonymousCommand_1 = require("./AnonymousCommand");
6
+ class ContextCommand extends AnonymousCommand_1.default {
7
+ saveContextInfo(context) {
8
+ const filePath = '.m365rc.json';
9
+ let m365rc = {};
10
+ if (fs.existsSync(filePath)) {
11
+ try {
12
+ const fileContents = fs.readFileSync(filePath, 'utf8');
13
+ if (fileContents) {
14
+ m365rc = JSON.parse(fileContents);
15
+ }
16
+ }
17
+ catch (e) {
18
+ throw new Command_1.CommandError(`Error reading ${filePath}: ${e}. Please add context info to ${filePath} manually.`);
19
+ }
20
+ }
21
+ if (!m365rc.context) {
22
+ m365rc.context = context;
23
+ try {
24
+ fs.writeFileSync(filePath, JSON.stringify(m365rc, null, 2));
25
+ }
26
+ catch (e) {
27
+ throw new Command_1.CommandError(`Error writing ${filePath}: ${e}. Please add context info to ${filePath} manually.`);
28
+ }
29
+ }
30
+ }
31
+ }
32
+ exports.default = ContextCommand;
33
+ //# sourceMappingURL=ContextCommand.js.map
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const ContextCommand_1 = require("../../base/ContextCommand");
13
+ const commands_1 = require("../commands");
14
+ class ContextInitCommand extends ContextCommand_1.default {
15
+ get name() {
16
+ return commands_1.default.INIT;
17
+ }
18
+ get description() {
19
+ return 'Initiates CLI for Microsoft 365 context in the current working folder';
20
+ }
21
+ commandAction() {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ yield this.saveContextInfo({});
24
+ });
25
+ }
26
+ }
27
+ module.exports = new ContextInitCommand();
28
+ //# sourceMappingURL=context-init.js.map
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const prefix = 'context';
4
+ exports.default = {
5
+ INIT: `${prefix} init`
6
+ };
7
+ //# sourceMappingURL=commands.js.map
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
14
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
15
  };
16
- var _SpoListLabelGetCommand_instances, _SpoListLabelGetCommand_initTelemetry, _SpoListLabelGetCommand_initOptions, _SpoListLabelGetCommand_initValidators, _SpoListLabelGetCommand_initOptionSets;
16
+ var _SpoListRetentionLabelGetCommand_instances, _SpoListRetentionLabelGetCommand_initTelemetry, _SpoListRetentionLabelGetCommand_initOptions, _SpoListRetentionLabelGetCommand_initValidators, _SpoListRetentionLabelGetCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const formatting_1 = require("../../../../utils/formatting");
@@ -21,23 +21,27 @@ const urlUtil_1 = require("../../../../utils/urlUtil");
21
21
  const validation_1 = require("../../../../utils/validation");
22
22
  const SpoCommand_1 = require("../../../base/SpoCommand");
23
23
  const commands_1 = require("../../commands");
24
- class SpoListLabelGetCommand extends SpoCommand_1.default {
24
+ class SpoListRetentionLabelGetCommand extends SpoCommand_1.default {
25
25
  get name() {
26
- return commands_1.default.LIST_LABEL_GET;
26
+ return commands_1.default.LIST_RETENTIONLABEL_GET;
27
+ }
28
+ alias() {
29
+ return [commands_1.default.LIST_LABEL_GET];
27
30
  }
28
31
  get description() {
29
- return 'Gets label set on the specified list';
32
+ return 'Gets the default retention label set on the specified list or library.';
30
33
  }
31
34
  constructor() {
32
35
  super();
33
- _SpoListLabelGetCommand_instances.add(this);
34
- __classPrivateFieldGet(this, _SpoListLabelGetCommand_instances, "m", _SpoListLabelGetCommand_initTelemetry).call(this);
35
- __classPrivateFieldGet(this, _SpoListLabelGetCommand_instances, "m", _SpoListLabelGetCommand_initOptions).call(this);
36
- __classPrivateFieldGet(this, _SpoListLabelGetCommand_instances, "m", _SpoListLabelGetCommand_initValidators).call(this);
37
- __classPrivateFieldGet(this, _SpoListLabelGetCommand_instances, "m", _SpoListLabelGetCommand_initOptionSets).call(this);
36
+ _SpoListRetentionLabelGetCommand_instances.add(this);
37
+ __classPrivateFieldGet(this, _SpoListRetentionLabelGetCommand_instances, "m", _SpoListRetentionLabelGetCommand_initTelemetry).call(this);
38
+ __classPrivateFieldGet(this, _SpoListRetentionLabelGetCommand_instances, "m", _SpoListRetentionLabelGetCommand_initOptions).call(this);
39
+ __classPrivateFieldGet(this, _SpoListRetentionLabelGetCommand_instances, "m", _SpoListRetentionLabelGetCommand_initValidators).call(this);
40
+ __classPrivateFieldGet(this, _SpoListRetentionLabelGetCommand_instances, "m", _SpoListRetentionLabelGetCommand_initOptionSets).call(this);
38
41
  }
39
42
  commandAction(logger, args) {
40
43
  return __awaiter(this, void 0, void 0, function* () {
44
+ this.showDeprecationWarning(logger, commands_1.default.LIST_LABEL_GET, commands_1.default.LIST_RETENTIONLABEL_GET);
41
45
  try {
42
46
  if (this.verbose) {
43
47
  logger.logToStderr(`Getting label set on the list ${args.options.listId || args.options.listTitle || args.options.listUrl} in site at ${args.options.webUrl}...`);
@@ -96,7 +100,7 @@ class SpoListLabelGetCommand extends SpoCommand_1.default {
96
100
  });
97
101
  }
98
102
  }
99
- _SpoListLabelGetCommand_instances = new WeakSet(), _SpoListLabelGetCommand_initTelemetry = function _SpoListLabelGetCommand_initTelemetry() {
103
+ _SpoListRetentionLabelGetCommand_instances = new WeakSet(), _SpoListRetentionLabelGetCommand_initTelemetry = function _SpoListRetentionLabelGetCommand_initTelemetry() {
100
104
  this.telemetry.push((args) => {
101
105
  Object.assign(this.telemetryProperties, {
102
106
  listId: (!(!args.options.listId)).toString(),
@@ -104,7 +108,7 @@ _SpoListLabelGetCommand_instances = new WeakSet(), _SpoListLabelGetCommand_initT
104
108
  listUrl: (!(!args.options.listUrl)).toString()
105
109
  });
106
110
  });
107
- }, _SpoListLabelGetCommand_initOptions = function _SpoListLabelGetCommand_initOptions() {
111
+ }, _SpoListRetentionLabelGetCommand_initOptions = function _SpoListRetentionLabelGetCommand_initOptions() {
108
112
  this.options.unshift({
109
113
  option: '-u, --webUrl <webUrl>'
110
114
  }, {
@@ -114,7 +118,7 @@ _SpoListLabelGetCommand_instances = new WeakSet(), _SpoListLabelGetCommand_initT
114
118
  }, {
115
119
  option: '--listUrl [listUrl]'
116
120
  });
117
- }, _SpoListLabelGetCommand_initValidators = function _SpoListLabelGetCommand_initValidators() {
121
+ }, _SpoListRetentionLabelGetCommand_initValidators = function _SpoListRetentionLabelGetCommand_initValidators() {
118
122
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
119
123
  const isValidSharePointUrl = validation_1.validation.isValidSharePointUrl(args.options.webUrl);
120
124
  if (isValidSharePointUrl !== true) {
@@ -127,8 +131,8 @@ _SpoListLabelGetCommand_instances = new WeakSet(), _SpoListLabelGetCommand_initT
127
131
  }
128
132
  return true;
129
133
  }));
130
- }, _SpoListLabelGetCommand_initOptionSets = function _SpoListLabelGetCommand_initOptionSets() {
134
+ }, _SpoListRetentionLabelGetCommand_initOptionSets = function _SpoListRetentionLabelGetCommand_initOptionSets() {
131
135
  this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
132
136
  };
133
- module.exports = new SpoListLabelGetCommand();
134
- //# sourceMappingURL=list-label-get.js.map
137
+ module.exports = new SpoListRetentionLabelGetCommand();
138
+ //# sourceMappingURL=list-retentionlabel-get.js.map
@@ -13,7 +13,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
13
13
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
14
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
15
  };
16
- var _SpoListLabelSetCommand_instances, _SpoListLabelSetCommand_initTelemetry, _SpoListLabelSetCommand_initOptions, _SpoListLabelSetCommand_initValidators, _SpoListLabelSetCommand_initOptionSets;
16
+ var _SpoListRetentionLabelSetCommand_instances, _SpoListRetentionLabelSetCommand_initTelemetry, _SpoListRetentionLabelSetCommand_initOptions, _SpoListRetentionLabelSetCommand_initValidators, _SpoListRetentionLabelSetCommand_initOptionSets;
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  const request_1 = require("../../../../request");
19
19
  const formatting_1 = require("../../../../utils/formatting");
@@ -21,23 +21,27 @@ const urlUtil_1 = require("../../../../utils/urlUtil");
21
21
  const validation_1 = require("../../../../utils/validation");
22
22
  const SpoCommand_1 = require("../../../base/SpoCommand");
23
23
  const commands_1 = require("../../commands");
24
- class SpoListLabelSetCommand extends SpoCommand_1.default {
24
+ class SpoListRetentionLabelSetCommand extends SpoCommand_1.default {
25
25
  get name() {
26
- return commands_1.default.LIST_LABEL_SET;
26
+ return commands_1.default.LIST_RETENTIONLABEL_SET;
27
+ }
28
+ alias() {
29
+ return [commands_1.default.LIST_LABEL_SET];
27
30
  }
28
31
  get description() {
29
- return 'Sets classification label on the specified list';
32
+ return 'Sets a default retention label on the specified list or library.';
30
33
  }
31
34
  constructor() {
32
35
  super();
33
- _SpoListLabelSetCommand_instances.add(this);
34
- __classPrivateFieldGet(this, _SpoListLabelSetCommand_instances, "m", _SpoListLabelSetCommand_initTelemetry).call(this);
35
- __classPrivateFieldGet(this, _SpoListLabelSetCommand_instances, "m", _SpoListLabelSetCommand_initOptions).call(this);
36
- __classPrivateFieldGet(this, _SpoListLabelSetCommand_instances, "m", _SpoListLabelSetCommand_initValidators).call(this);
37
- __classPrivateFieldGet(this, _SpoListLabelSetCommand_instances, "m", _SpoListLabelSetCommand_initOptionSets).call(this);
36
+ _SpoListRetentionLabelSetCommand_instances.add(this);
37
+ __classPrivateFieldGet(this, _SpoListRetentionLabelSetCommand_instances, "m", _SpoListRetentionLabelSetCommand_initTelemetry).call(this);
38
+ __classPrivateFieldGet(this, _SpoListRetentionLabelSetCommand_instances, "m", _SpoListRetentionLabelSetCommand_initOptions).call(this);
39
+ __classPrivateFieldGet(this, _SpoListRetentionLabelSetCommand_instances, "m", _SpoListRetentionLabelSetCommand_initValidators).call(this);
40
+ __classPrivateFieldGet(this, _SpoListRetentionLabelSetCommand_instances, "m", _SpoListRetentionLabelSetCommand_initOptionSets).call(this);
38
41
  }
39
42
  commandAction(logger, args) {
40
43
  return __awaiter(this, void 0, void 0, function* () {
44
+ this.showDeprecationWarning(logger, commands_1.default.LIST_LABEL_SET, commands_1.default.LIST_RETENTIONLABEL_SET);
41
45
  try {
42
46
  let listRestUrl = '';
43
47
  let listServerRelativeUrl = '';
@@ -86,7 +90,7 @@ class SpoListLabelSetCommand extends SpoCommand_1.default {
86
90
  });
87
91
  }
88
92
  }
89
- _SpoListLabelSetCommand_instances = new WeakSet(), _SpoListLabelSetCommand_initTelemetry = function _SpoListLabelSetCommand_initTelemetry() {
93
+ _SpoListRetentionLabelSetCommand_instances = new WeakSet(), _SpoListRetentionLabelSetCommand_initTelemetry = function _SpoListRetentionLabelSetCommand_initTelemetry() {
90
94
  this.telemetry.push((args) => {
91
95
  Object.assign(this.telemetryProperties, {
92
96
  listId: (!(!args.options.listId)).toString(),
@@ -97,7 +101,7 @@ _SpoListLabelSetCommand_instances = new WeakSet(), _SpoListLabelSetCommand_initT
97
101
  blockEdit: args.options.blockEdit || false
98
102
  });
99
103
  });
100
- }, _SpoListLabelSetCommand_initOptions = function _SpoListLabelSetCommand_initOptions() {
104
+ }, _SpoListRetentionLabelSetCommand_initOptions = function _SpoListRetentionLabelSetCommand_initOptions() {
101
105
  this.options.unshift({
102
106
  option: '-u, --webUrl <webUrl>'
103
107
  }, {
@@ -115,15 +119,15 @@ _SpoListLabelSetCommand_instances = new WeakSet(), _SpoListLabelSetCommand_initT
115
119
  }, {
116
120
  option: '--blockEdit'
117
121
  });
118
- }, _SpoListLabelSetCommand_initValidators = function _SpoListLabelSetCommand_initValidators() {
122
+ }, _SpoListRetentionLabelSetCommand_initValidators = function _SpoListRetentionLabelSetCommand_initValidators() {
119
123
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
120
124
  if (args.options.listId && !validation_1.validation.isValidGuid(args.options.listId)) {
121
125
  return `${args.options.listId} is not a valid GUID`;
122
126
  }
123
127
  return validation_1.validation.isValidSharePointUrl(args.options.webUrl);
124
128
  }));
125
- }, _SpoListLabelSetCommand_initOptionSets = function _SpoListLabelSetCommand_initOptionSets() {
129
+ }, _SpoListRetentionLabelSetCommand_initOptionSets = function _SpoListRetentionLabelSetCommand_initOptionSets() {
126
130
  this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
127
131
  };
128
- module.exports = new SpoListLabelSetCommand();
129
- //# sourceMappingURL=list-label-set.js.map
132
+ module.exports = new SpoListRetentionLabelSetCommand();
133
+ //# sourceMappingURL=list-retentionlabel-set.js.map
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
12
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
13
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
14
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
15
+ };
16
+ var _SpoWebRetentionLabelListCommand_instances, _SpoWebRetentionLabelListCommand_initOptions, _SpoWebRetentionLabelListCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const odata_1 = require("../../../../utils/odata");
19
+ const validation_1 = require("../../../../utils/validation");
20
+ const SpoCommand_1 = require("../../../base/SpoCommand");
21
+ const commands_1 = require("../../commands");
22
+ const formatting_1 = require("../../../../utils/formatting");
23
+ class SpoWebRetentionLabelListCommand extends SpoCommand_1.default {
24
+ get name() {
25
+ return commands_1.default.WEB_RETENTIONLABEL_LIST;
26
+ }
27
+ get description() {
28
+ return `Get a list of retention labels that are available on a site.`;
29
+ }
30
+ defaultProperties() {
31
+ return ['TagId', 'TagName'];
32
+ }
33
+ constructor() {
34
+ super();
35
+ _SpoWebRetentionLabelListCommand_instances.add(this);
36
+ __classPrivateFieldGet(this, _SpoWebRetentionLabelListCommand_instances, "m", _SpoWebRetentionLabelListCommand_initOptions).call(this);
37
+ __classPrivateFieldGet(this, _SpoWebRetentionLabelListCommand_instances, "m", _SpoWebRetentionLabelListCommand_initValidators).call(this);
38
+ }
39
+ commandAction(logger, args) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ if (this.verbose) {
42
+ logger.logToStderr(`Retrieving all retention labels that are available on ${args.options.webUrl}...`);
43
+ }
44
+ const requestUrl = `${args.options.webUrl}/_api/SP.CompliancePolicy.SPPolicyStoreProxy.GetAvailableTagsForSite(siteUrl=@a1)?@a1='${formatting_1.formatting.encodeQueryParameter(args.options.webUrl)}'`;
45
+ try {
46
+ const response = yield odata_1.odata.getAllItems(requestUrl);
47
+ logger.log(response);
48
+ }
49
+ catch (err) {
50
+ this.handleRejectedODataJsonPromise(err);
51
+ }
52
+ });
53
+ }
54
+ }
55
+ _SpoWebRetentionLabelListCommand_instances = new WeakSet(), _SpoWebRetentionLabelListCommand_initOptions = function _SpoWebRetentionLabelListCommand_initOptions() {
56
+ this.options.unshift({
57
+ option: '-u, --webUrl <webUrl>'
58
+ });
59
+ }, _SpoWebRetentionLabelListCommand_initValidators = function _SpoWebRetentionLabelListCommand_initValidators() {
60
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () { return validation_1.validation.isValidSharePointUrl(args.options.webUrl); }));
61
+ };
62
+ module.exports = new SpoWebRetentionLabelListCommand();
63
+ //# sourceMappingURL=web-retentionlabel-list.js.map
@@ -115,6 +115,8 @@ exports.default = {
115
115
  LIST_LABEL_SET: `${prefix} list label set`,
116
116
  LIST_LIST: `${prefix} list list`,
117
117
  LIST_REMOVE: `${prefix} list remove`,
118
+ LIST_RETENTIONLABEL_GET: `${prefix} list retentionlabel get`,
119
+ LIST_RETENTIONLABEL_SET: `${prefix} list retentionlabel set`,
118
120
  LIST_ROLEASSIGNMENT_REMOVE: `${prefix} list roleassignment remove`,
119
121
  LIST_ROLEASSIGNMENT_ADD: `${prefix} list roleassignment add`,
120
122
  LIST_ROLEINHERITANCE_BREAK: `${prefix} list roleinheritance break`,
@@ -288,6 +290,7 @@ exports.default = {
288
290
  WEB_LIST: `${prefix} web list`,
289
291
  WEB_REINDEX: `${prefix} web reindex`,
290
292
  WEB_REMOVE: `${prefix} web remove`,
293
+ WEB_RETENTIONLABEL_LIST: `${prefix} web retentionlabel list`,
291
294
  WEB_ROLEASSIGNMENT_REMOVE: `${prefix} web roleassignment remove`,
292
295
  WEB_ROLEASSIGNMENT_ADD: `${prefix} web roleassignment add`,
293
296
  WEB_ROLEINHERITANCE_BREAK: `${prefix} web roleinheritance break`,
@@ -11,13 +11,25 @@ m365 aad user set [options]
11
11
  ## Options
12
12
 
13
13
  `-i, --objectId [objectId]`
14
- : The object ID of the user to update. Specify `objectId` or `userPrincipalName` but not both
14
+ : The object ID of the user to update. Specify `objectId` or `userPrincipalName` but not both.
15
15
 
16
16
  `-n, --userPrincipalName [userPrincipalName]`
17
- : User principal name of the user to update. Specify `objectId` or `userPrincipalName` but not both
17
+ : User principal name of the user to update. Specify `objectId` or `userPrincipalName` but not both.
18
18
 
19
19
  `--accountEnabled [accountEnabled]`
20
- : Boolean value specifying whether the account is enabled. Valid values are `true,false`
20
+ : Boolean value specifying whether the account is enabled. Valid values are `true` or `false`.
21
+
22
+ `--resetPassword`
23
+ : If specified, the password of the user will be reset. This will make the parameter `newPassword` required.
24
+
25
+ `--forceChangePasswordNextSignIn`
26
+ : If specified, the user will have to change his password the next time they log in. Can only be set in combination with `resetPassword`.
27
+
28
+ `--currentPassword [currentPassword]`
29
+ : Current password of the user that is signed in. If this parameter is set, `newPassword` is mandatory. Can't be combined with `resetPassword`.
30
+
31
+ `--newPassword [newPassword]`
32
+ : New password to be set. Must be set when specifying either `resetPassword` or `currentPassword`.
21
33
 
22
34
  --8<-- "docs/cmd/_global.md"
23
35
 
@@ -58,3 +70,19 @@ Enable user with id _1caf7dcd-7e83-4c3a-94f7-932a1299c844_
58
70
  ```sh
59
71
  m365 aad user set --objectId 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --accountEnabled true
60
72
  ```
73
+
74
+ Reset password of a given user by userPrincipalName and require the user to change the password on the next sign in
75
+
76
+ ```sh
77
+ m365 aad user set --userPrincipalName steve@contoso.onmicrosoft.com --resetPassword --password 6NLUId79Lc24 --forceChangePasswordNextSignIn
78
+ ```
79
+
80
+ Change password of the currently logged in user
81
+
82
+ ```sh
83
+ m365 aad user set --objectId 1caf7dcd-7e83-4c3a-94f7-932a1299c844 --currentPassword SLBF5gnRtyYc --newPassword 6NLUId79Lc24
84
+ ```
85
+
86
+ ### Response
87
+
88
+ The command won't return a response on success.
@@ -0,0 +1,25 @@
1
+ # context init
2
+
3
+ Initiates CLI for Microsoft 365 context in the current working folder
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 context init [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ --8<-- "docs/cmd/_global.md"
14
+
15
+ ## Examples
16
+
17
+ Initiates CLI for Microsoft 365 context in the current working folder
18
+
19
+ ```sh
20
+ m365 context init
21
+ ```
22
+
23
+ ## Response
24
+
25
+ The command won't return a response on success.
@@ -1,11 +1,17 @@
1
- # spo list label get
1
+ # spo list retentionlabel get
2
2
 
3
- Gets label set on the specified list
3
+ Gets the default retention label set on the specified list or library.
4
4
 
5
5
  ## Usage
6
6
 
7
7
  ```sh
8
- m365 spo list label get [options]
8
+ m365 spo list retentionlabel get [options]
9
+ ```
10
+
11
+ ## Alias
12
+
13
+ ```sh
14
+ m365 spo list label get [options]
9
15
  ```
10
16
 
11
17
  ## Options
@@ -26,28 +32,28 @@ m365 spo list label get [options]
26
32
 
27
33
  ## Examples
28
34
 
29
- Gets label set on the list with specified title located in the specified site.
35
+ Gets retention label set on the list with specified title located in the specified site.
30
36
 
31
37
  ```sh
32
- m365 spo list label get --listTitle ContosoList --webUrl https://contoso.sharepoint.com/sites/project-x
38
+ m365 spo list retentionlabel get --listTitle ContosoList --webUrl https://contoso.sharepoint.com/sites/project-x
33
39
  ```
34
40
 
35
- Gets label set on the list with specified id located in the specified site.
41
+ Gets retention label set on the list with specified id located in the specified site.
36
42
 
37
43
  ```sh
38
- m365 spo list label get --listId cc27a922-8224-4296-90a5-ebbc54da2e85 --webUrl https://contoso.sharepoint.com/sites/project-x
44
+ m365 spo list retentionlabel get --listId cc27a922-8224-4296-90a5-ebbc54da2e85 --webUrl https://contoso.sharepoint.com/sites/project-x
39
45
  ```
40
46
 
41
- Gets label set on the list with specified server relative url located in the specified site.
47
+ Gets retention label set on the list with specified server relative url located in the specified site.
42
48
 
43
49
  ```sh
44
- m365 spo list label get --listUrl 'sites/project-x/Documents' --webUrl https://contoso.sharepoint.com/sites/project-x
50
+ m365 spo list retentionlabel get --listUrl 'sites/project-x/Documents' --webUrl https://contoso.sharepoint.com/sites/project-x
45
51
  ```
46
52
 
47
- Gets label set on the list with specified site-relative URL located in the specified site.
53
+ Gets retention label set on the list with specified site-relative URL located in the specified site.
48
54
 
49
55
  ```sh
50
- m365 spo list label get --listUrl 'Shared Documents' --webUrl https://contoso.sharepoint.com/sites/project-x
56
+ m365 spo list retentionlabel get --listUrl 'Shared Documents' --webUrl https://contoso.sharepoint.com/sites/project-x
51
57
  ```
52
58
 
53
59
  ## Response