@pnp/cli-microsoft365 6.5.0-beta.33bab12 → 6.5.0-beta.ccd8e85

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.
package/.eslintrc.js CHANGED
@@ -10,6 +10,7 @@ const dictionary = [
10
10
  'application',
11
11
  'apply',
12
12
  'approve',
13
+ 'assessment',
13
14
  'assets',
14
15
  'audit',
15
16
  'bin',
@@ -84,6 +85,7 @@ const dictionary = [
84
85
  'storage',
85
86
  'table',
86
87
  'teams',
88
+ 'threat',
87
89
  'token',
88
90
  'type',
89
91
  'user',
package/dist/Command.js CHANGED
@@ -458,9 +458,18 @@ class Command {
458
458
  // replace unescaped newlines with escaped newlines #2807
459
459
  .replace(/([^\\])\\n/g, '$1\\\\\\n');
460
460
  }
461
- getCsvOutput(logStatement) {
461
+ getCsvOutput(logStatement, options) {
462
462
  const { stringify } = require('csv-stringify/sync');
463
463
  const cli = Cli_1.Cli.getInstance();
464
+ if (logStatement && logStatement.length > 0 && !options.query) {
465
+ logStatement.map(l => {
466
+ for (const x of Object.keys(l)) {
467
+ if (typeof l[x] === 'object') {
468
+ delete l[x];
469
+ }
470
+ }
471
+ });
472
+ }
464
473
  // https://csv.js.org/stringify/options/
465
474
  return stringify(logStatement, {
466
475
  header: cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.csvHeader, true),
@@ -494,13 +503,14 @@ class Command {
494
503
  output.push(`## ${id}`, os.EOL, os.EOL);
495
504
  }
496
505
  output.push(`Property | Value`, os.EOL, `---------|-------`, os.EOL);
497
- output.push(Object.keys(l).map(k => {
498
- const value = l[k];
499
- let stringValue = value;
500
- if (typeof value === 'object') {
501
- stringValue = JSON.stringify(value);
506
+ output.push(Object.keys(l).filter(x => {
507
+ if (!options.query && typeof l[x] === 'object') {
508
+ return;
502
509
  }
503
- return `${md_1.md.escapeMd(k)} | ${md_1.md.escapeMd(stringValue)}`;
510
+ return x;
511
+ }).map(k => {
512
+ const value = l[k];
513
+ return `${md_1.md.escapeMd(k)} | ${md_1.md.escapeMd(value)}`;
504
514
  }).join(os.EOL), os.EOL);
505
515
  output.push(os.EOL);
506
516
  });
package/dist/cli/Cli.js CHANGED
@@ -158,9 +158,10 @@ class Cli {
158
158
  const cli = Cli.getInstance();
159
159
  const parentCommandName = cli.currentCommandName;
160
160
  cli.currentCommandName = command.getCommandName(cli.currentCommandName);
161
+ const showSpinner = cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.showSpinner, true);
161
162
  // don't show spinner if running tests
162
163
  /* c8 ignore next 3 */
163
- if (typeof global.it === 'undefined') {
164
+ if (showSpinner && typeof global.it === 'undefined') {
164
165
  cli.spinner.start();
165
166
  }
166
167
  try {
@@ -529,7 +530,7 @@ class Cli {
529
530
  }
530
531
  switch (options.output) {
531
532
  case 'csv':
532
- return command.getCsvOutput(logStatement);
533
+ return command.getCsvOutput(logStatement, options);
533
534
  case 'md':
534
535
  return command.getMdOutput(logStatement, command, options);
535
536
  default:
@@ -756,9 +757,10 @@ class Cli {
756
757
  /* c8 ignore next */
757
758
  }
758
759
  static log(message, ...optionalParams) {
760
+ const cli = Cli.getInstance();
759
761
  /* c8 ignore next 3 */
760
- if (Cli.getInstance().spinner.isSpinning) {
761
- Cli.getInstance().spinner.stop();
762
+ if (cli.spinner.isSpinning) {
763
+ cli.spinner.stop();
762
764
  }
763
765
  if (message) {
764
766
  console.log(message, ...optionalParams);
@@ -768,11 +770,12 @@ class Cli {
768
770
  }
769
771
  }
770
772
  static error(message, ...optionalParams) {
773
+ const cli = Cli.getInstance();
771
774
  /* c8 ignore next 3 */
772
- if (Cli.getInstance().spinner.isSpinning) {
773
- Cli.getInstance().spinner.stop();
775
+ if (cli.spinner.isSpinning) {
776
+ cli.spinner.stop();
774
777
  }
775
- const errorOutput = Cli.getInstance().getSettingWithDefaultValue(settingsNames_1.settingsNames.errorOutput, 'stderr');
778
+ const errorOutput = cli.getSettingWithDefaultValue(settingsNames_1.settingsNames.errorOutput, 'stderr');
776
779
  if (errorOutput === 'stdout') {
777
780
  console.log(message, ...optionalParams);
778
781
  }
@@ -783,16 +786,17 @@ class Cli {
783
786
  static prompt(options) {
784
787
  return __awaiter(this, void 0, void 0, function* () {
785
788
  const inquirer = require('inquirer');
786
- const spinnerSpinning = Cli.getInstance().spinner.isSpinning;
789
+ const cli = Cli.getInstance();
790
+ const spinnerSpinning = cli.spinner.isSpinning;
787
791
  /* c8 ignore next 3 */
788
792
  if (spinnerSpinning) {
789
- Cli.getInstance().spinner.stop();
793
+ cli.spinner.stop();
790
794
  }
791
795
  const response = yield inquirer.prompt(options);
792
796
  // Restart the spinner if it was running before the prompt
793
797
  /* c8 ignore next 3 */
794
798
  if (spinnerSpinning) {
795
- Cli.getInstance().spinner.start();
799
+ cli.spinner.start();
796
800
  }
797
801
  return response;
798
802
  });
@@ -822,7 +826,7 @@ class Cli {
822
826
  });
823
827
  }
824
828
  static shouldTrimOutput(output) {
825
- return output === 'text' || output === 'csv';
829
+ return output === 'text';
826
830
  }
827
831
  }
828
832
  exports.Cli = Cli;
@@ -46,6 +46,7 @@ class CliConfigSetCommand extends AnonymousCommand_1.default {
46
46
  case settingsNames_1.settingsNames.printErrorsAsPlainText:
47
47
  case settingsNames_1.settingsNames.prompt:
48
48
  case settingsNames_1.settingsNames.showHelpOnFailure:
49
+ case settingsNames_1.settingsNames.showSpinner:
49
50
  value = args.options.value === 'true';
50
51
  break;
51
52
  default:
@@ -0,0 +1,197 @@
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 _PaAppExportCommand_instances, _PaAppExportCommand_initTelemetry, _PaAppExportCommand_initOptions, _PaAppExportCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const validation_1 = require("../../../../utils/validation");
19
+ const commands_1 = require("../../commands");
20
+ const fs = require("fs");
21
+ const path = require("path");
22
+ const formatting_1 = require("../../../../utils/formatting");
23
+ const request_1 = require("../../../../request");
24
+ const PowerPlatformCommand_1 = require("../../../base/PowerPlatformCommand");
25
+ class PaAppExportCommand extends PowerPlatformCommand_1.default {
26
+ get name() {
27
+ return commands_1.default.APP_EXPORT;
28
+ }
29
+ get description() {
30
+ return 'Exports the specified Power App';
31
+ }
32
+ constructor() {
33
+ super();
34
+ _PaAppExportCommand_instances.add(this);
35
+ __classPrivateFieldGet(this, _PaAppExportCommand_instances, "m", _PaAppExportCommand_initTelemetry).call(this);
36
+ __classPrivateFieldGet(this, _PaAppExportCommand_instances, "m", _PaAppExportCommand_initOptions).call(this);
37
+ __classPrivateFieldGet(this, _PaAppExportCommand_instances, "m", _PaAppExportCommand_initValidators).call(this);
38
+ }
39
+ commandAction(logger, args) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ try {
42
+ const location = yield this.exportPackage(args, logger);
43
+ const packageLink = yield this.getPackageLink(args, logger, location);
44
+ //Replace all illegal characters from the file name
45
+ const illegalCharsRegEx = /[\\\/:*?"<>|]/g;
46
+ const filename = args.options.packageDisplayName.replace(illegalCharsRegEx, '_');
47
+ const requestOptions = {
48
+ url: packageLink,
49
+ // Set responseType to arraybuffer, otherwise binary data will be encoded
50
+ // to utf8 and binary data is corrupt
51
+ responseType: 'arraybuffer',
52
+ headers: {
53
+ 'x-anonymous': true
54
+ }
55
+ };
56
+ const file = yield request_1.default.get(requestOptions);
57
+ let path = args.options.path || './';
58
+ if (!path.endsWith('/')) {
59
+ path += '/';
60
+ }
61
+ path += `${filename}.zip`;
62
+ fs.writeFileSync(path, file, 'binary');
63
+ if (this.verbose) {
64
+ logger.logToStderr(`File saved to path '${path}'`);
65
+ }
66
+ }
67
+ catch (err) {
68
+ this.handleRejectedODataJsonPromise(err);
69
+ }
70
+ });
71
+ }
72
+ getPackageResources(args, logger) {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ if (this.verbose) {
75
+ logger.logToStderr('Getting the Microsoft Power App resources...');
76
+ }
77
+ const requestOptions = {
78
+ url: `${this.resource}/providers/Microsoft.BusinessAppPlatform/environments/${formatting_1.formatting.encodeQueryParameter(args.options.environment)}/listPackageResources?api-version=2016-11-01`,
79
+ headers: {
80
+ accept: 'application/json'
81
+ },
82
+ data: {
83
+ baseResourceIds: [
84
+ `/providers/Microsoft.PowerApps/apps/${args.options.id}`
85
+ ]
86
+ },
87
+ responseType: 'json'
88
+ };
89
+ const response = yield request_1.default.post(requestOptions);
90
+ Object.keys(response.resources).forEach((key) => {
91
+ response.resources[key].suggestedCreationType = 'Update';
92
+ });
93
+ return response.resources;
94
+ });
95
+ }
96
+ exportPackage(args, logger) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ if (this.verbose) {
99
+ logger.logToStderr(`Initiating package export for Microsoft Power App ${args.options.id}...`);
100
+ }
101
+ const resources = yield this.getPackageResources(args, logger);
102
+ const requestOptions = {
103
+ url: `${this.resource}/providers/Microsoft.BusinessAppPlatform/environments/${formatting_1.formatting.encodeQueryParameter(args.options.environment)}/exportPackage?api-version=2016-11-01`,
104
+ headers: {
105
+ accept: 'application/json'
106
+ },
107
+ responseType: 'json',
108
+ data: {
109
+ includedResourceIds: [
110
+ `/providers/Microsoft.PowerApps/apps/${args.options.id}`
111
+ ],
112
+ details: {
113
+ creator: args.options.packageCreatedBy,
114
+ description: args.options.packageDescription,
115
+ displayName: args.options.packageDisplayName,
116
+ sourceEnvironment: args.options.packageSourceEnvironment
117
+ },
118
+ resources: resources
119
+ },
120
+ fullResponse: true
121
+ };
122
+ const response = yield request_1.default.post(requestOptions);
123
+ return response.headers.location;
124
+ });
125
+ }
126
+ getPackageLink(args, logger, location) {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ if (this.verbose) {
129
+ logger.logToStderr('Retrieving the package link and waiting on the exported package.');
130
+ }
131
+ let status;
132
+ let link;
133
+ const requestOptions = {
134
+ url: location,
135
+ headers: {
136
+ accept: 'application/json'
137
+ },
138
+ responseType: 'json'
139
+ };
140
+ do {
141
+ const response = yield request_1.default.get(requestOptions);
142
+ status = response.properties.status;
143
+ if (status === "Succeeded") {
144
+ link = response.properties.packageLink.value;
145
+ }
146
+ else {
147
+ yield this.sleep(5000);
148
+ }
149
+ if (this.verbose) {
150
+ logger.logToStderr(`Current status of the get package link: ${status}`);
151
+ }
152
+ } while (status === 'Running');
153
+ return link;
154
+ });
155
+ }
156
+ sleep(ms) {
157
+ return new Promise(resolve => setTimeout(resolve, ms));
158
+ }
159
+ }
160
+ _PaAppExportCommand_instances = new WeakSet(), _PaAppExportCommand_initTelemetry = function _PaAppExportCommand_initTelemetry() {
161
+ this.telemetry.push((args) => {
162
+ Object.assign(this.telemetryProperties, {
163
+ packageDescription: typeof args.options.packageDescription !== 'undefined',
164
+ packageCreatedBy: typeof args.options.packageCreatedBy !== 'undefined',
165
+ packageSourceEnvironment: typeof args.options.packageSourceEnvironment !== 'undefined',
166
+ path: typeof args.options.path !== 'undefined'
167
+ });
168
+ });
169
+ }, _PaAppExportCommand_initOptions = function _PaAppExportCommand_initOptions() {
170
+ this.options.unshift({
171
+ option: '-i, --id <id>'
172
+ }, {
173
+ option: '-e, --environment <environment>'
174
+ }, {
175
+ option: '-n, --packageDisplayName [packageDisplayName]'
176
+ }, {
177
+ option: '-d, --packageDescription [packageDescription]'
178
+ }, {
179
+ option: '-c, --packageCreatedBy [packageCreatedBy]'
180
+ }, {
181
+ option: '-s, --packageSourceEnvironment [packageSourceEnvironment]'
182
+ }, {
183
+ option: '-p, --path [path]'
184
+ });
185
+ }, _PaAppExportCommand_initValidators = function _PaAppExportCommand_initValidators() {
186
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
187
+ if (args.options.id && !validation_1.validation.isValidGuid(args.options.id)) {
188
+ return `${args.options.id} is not a valid GUID`;
189
+ }
190
+ if (args.options.path && !fs.existsSync(path.dirname(args.options.path))) {
191
+ return 'Specified path where to save the file does not exist';
192
+ }
193
+ return true;
194
+ }));
195
+ };
196
+ module.exports = new PaAppExportCommand();
197
+ //# sourceMappingURL=app-export.js.map
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const prefix = 'pa';
4
4
  exports.default = {
5
+ APP_EXPORT: `${prefix} app export`,
5
6
  APP_GET: `${prefix} app get`,
6
7
  APP_LIST: `${prefix} app list`,
7
8
  APP_REMOVE: `${prefix} app remove`,
@@ -0,0 +1,79 @@
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 _PurviewThreatAssessmentGetCommand_instances, _PurviewThreatAssessmentGetCommand_initTelemetry, _PurviewThreatAssessmentGetCommand_initOptions, _PurviewThreatAssessmentGetCommand_initValidators;
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const request_1 = require("../../../../request");
19
+ const validation_1 = require("../../../../utils/validation");
20
+ const GraphCommand_1 = require("../../../base/GraphCommand");
21
+ const commands_1 = require("../../commands");
22
+ class PurviewThreatAssessmentGetCommand extends GraphCommand_1.default {
23
+ get name() {
24
+ return commands_1.default.THREATASSESSMENT_GET;
25
+ }
26
+ get description() {
27
+ return 'Get a threat assessment';
28
+ }
29
+ constructor() {
30
+ super();
31
+ _PurviewThreatAssessmentGetCommand_instances.add(this);
32
+ __classPrivateFieldGet(this, _PurviewThreatAssessmentGetCommand_instances, "m", _PurviewThreatAssessmentGetCommand_initTelemetry).call(this);
33
+ __classPrivateFieldGet(this, _PurviewThreatAssessmentGetCommand_instances, "m", _PurviewThreatAssessmentGetCommand_initOptions).call(this);
34
+ __classPrivateFieldGet(this, _PurviewThreatAssessmentGetCommand_instances, "m", _PurviewThreatAssessmentGetCommand_initValidators).call(this);
35
+ }
36
+ commandAction(logger, args) {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ try {
39
+ if (this.verbose) {
40
+ logger.logToStderr(`Retrieving threat assessment with id ${args.options.id}`);
41
+ }
42
+ const requestOptions = {
43
+ url: `${this.resource}/v1.0/informationProtection/threatAssessmentRequests/${args.options.id}${args.options.includeResults ? '?$expand=results' : ''}`,
44
+ headers: {
45
+ accept: 'application/json;odata.metadata=none'
46
+ },
47
+ responseType: 'json'
48
+ };
49
+ const res = yield request_1.default.get(requestOptions);
50
+ logger.log(res);
51
+ }
52
+ catch (err) {
53
+ this.handleRejectedODataJsonPromise(err);
54
+ }
55
+ });
56
+ }
57
+ }
58
+ _PurviewThreatAssessmentGetCommand_instances = new WeakSet(), _PurviewThreatAssessmentGetCommand_initTelemetry = function _PurviewThreatAssessmentGetCommand_initTelemetry() {
59
+ this.telemetry.push((args) => {
60
+ Object.assign(this.telemetryProperties, {
61
+ includeResults: !!args.options.includeResults
62
+ });
63
+ });
64
+ }, _PurviewThreatAssessmentGetCommand_initOptions = function _PurviewThreatAssessmentGetCommand_initOptions() {
65
+ this.options.unshift({
66
+ option: '-i, --id <id>'
67
+ }, {
68
+ option: '--includeResults'
69
+ });
70
+ }, _PurviewThreatAssessmentGetCommand_initValidators = function _PurviewThreatAssessmentGetCommand_initValidators() {
71
+ this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
72
+ if (!validation_1.validation.isValidGuid(args.options.id)) {
73
+ return `${args.options.id} is not a valid GUID.`;
74
+ }
75
+ return true;
76
+ }));
77
+ };
78
+ module.exports = new PurviewThreatAssessmentGetCommand();
79
+ //# sourceMappingURL=threatassessment-get.js.map
@@ -16,6 +16,7 @@ exports.default = {
16
16
  RETENTIONLABEL_GET: `${prefix} retentionlabel get`,
17
17
  RETENTIONLABEL_LIST: `${prefix} retentionlabel list`,
18
18
  RETENTIONLABEL_REMOVE: `${prefix} retentionlabel remove`,
19
- RETENTIONLABEL_SET: `${prefix} retentionlabel set`
19
+ RETENTIONLABEL_SET: `${prefix} retentionlabel set`,
20
+ THREATASSESSMENT_GET: `${prefix} threatassessment get`
20
21
  };
21
22
  //# sourceMappingURL=commands.js.map
@@ -147,7 +147,7 @@ class SpoFileMoveCommand extends SpoCommand_1.default {
147
147
  yield Cli_1.Cli.executeCommand(removeCommand, { options: Object.assign(Object.assign({}, removeOptions), { _: [] }) });
148
148
  }
149
149
  catch (err) {
150
- if (err.error !== undefined && err.error.message !== undefined && err.error.message.includes('does not exist')) {
150
+ if (err !== undefined && err.message !== undefined && err.message.includes('does not exist')) {
151
151
  }
152
152
  else {
153
153
  throw err;
@@ -42,6 +42,9 @@ class SpoFileRetentionLabelEnsureCommand extends SpoCommand_1.default {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
43
  try {
44
44
  const fileProperties = yield this.getFileProperties(logger, args);
45
+ if (args.options.assetId) {
46
+ yield this.applyAssetId(args.options.webUrl, fileProperties.ListItemAllFields.ParentList.Id, fileProperties.ListItemAllFields.Id, args.options.assetId);
47
+ }
45
48
  const options = {
46
49
  webUrl: args.options.webUrl,
47
50
  listId: fileProperties.ListItemAllFields.ParentList.Id,
@@ -84,12 +87,28 @@ class SpoFileRetentionLabelEnsureCommand extends SpoCommand_1.default {
84
87
  return yield request_1.default.get(requestOptions);
85
88
  });
86
89
  }
90
+ applyAssetId(webUrl, listId, listItemId, assetId) {
91
+ return __awaiter(this, void 0, void 0, function* () {
92
+ const requestUrl = `${webUrl}/_api/web/lists(guid'${formatting_1.formatting.encodeQueryParameter(listId)}')`;
93
+ const requestBody = { "formValues": [{ "FieldName": "ComplianceAssetId", "FieldValue": assetId }] };
94
+ const requestOptions = {
95
+ url: `${requestUrl}/items(${listItemId})/ValidateUpdateListItem()`,
96
+ headers: {
97
+ 'accept': 'application/json;odata=nometadata'
98
+ },
99
+ data: requestBody,
100
+ responseType: 'json'
101
+ };
102
+ yield request_1.default.post(requestOptions);
103
+ });
104
+ }
87
105
  }
88
106
  _SpoFileRetentionLabelEnsureCommand_instances = new WeakSet(), _SpoFileRetentionLabelEnsureCommand_initTelemetry = function _SpoFileRetentionLabelEnsureCommand_initTelemetry() {
89
107
  this.telemetry.push((args) => {
90
108
  Object.assign(this.telemetryProperties, {
91
109
  fileUrl: typeof args.options.fileUrl !== 'undefined',
92
- fileId: typeof args.options.fileId !== 'undefined'
110
+ fileId: typeof args.options.fileId !== 'undefined',
111
+ assetId: typeof args.options.assetId !== 'undefined'
93
112
  });
94
113
  });
95
114
  }, _SpoFileRetentionLabelEnsureCommand_initOptions = function _SpoFileRetentionLabelEnsureCommand_initOptions() {
@@ -101,6 +120,8 @@ _SpoFileRetentionLabelEnsureCommand_instances = new WeakSet(), _SpoFileRetention
101
120
  option: '--fileUrl [fileUrl]'
102
121
  }, {
103
122
  option: '-i, --fileId [fileId]'
123
+ }, {
124
+ option: '-a, --assetId [assetId]'
104
125
  });
105
126
  }, _SpoFileRetentionLabelEnsureCommand_initValidators = function _SpoFileRetentionLabelEnsureCommand_initValidators() {
106
127
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
@@ -58,8 +58,14 @@ class SpoListItemGetCommand extends SpoCommand_1.default {
58
58
  const propertiesToExpand = propertiesWithSlash.map(e => e.split('/')[0]);
59
59
  const expandPropertiesArray = propertiesToExpand.filter((item, pos) => propertiesToExpand.indexOf(item) === pos);
60
60
  const fieldExpand = expandPropertiesArray.length > 0 ? `&$expand=${expandPropertiesArray.join(",")}` : ``;
61
+ if (args.options.id) {
62
+ requestUrl += `/items(${args.options.id})`;
63
+ }
64
+ else {
65
+ requestUrl += `/GetItemByUniqueId(guid'${args.options.uniqueId}')`;
66
+ }
61
67
  const requestOptions = {
62
- url: `${requestUrl}/items(${args.options.id})?$select=${formatting_1.formatting.encodeQueryParameter(propertiesSelect.join(","))}${fieldExpand}`,
68
+ url: `${requestUrl}?$select=${formatting_1.formatting.encodeQueryParameter(propertiesSelect.join(","))}${fieldExpand}`,
63
69
  headers: {
64
70
  'accept': 'application/json;odata=nometadata'
65
71
  },
@@ -68,7 +74,7 @@ class SpoListItemGetCommand extends SpoCommand_1.default {
68
74
  try {
69
75
  const itemProperties = yield request_1.default.get(requestOptions);
70
76
  if (args.options.withPermissions) {
71
- requestOptions.url = `${requestUrl}/items(${args.options.id})/RoleAssignments?$expand=Member,RoleDefinitionBindings`;
77
+ requestOptions.url = `${requestUrl}/RoleAssignments?$expand=Member,RoleDefinitionBindings`;
72
78
  const response = yield request_1.default.get(requestOptions);
73
79
  response.value.forEach((r) => {
74
80
  r.RoleDefinitionBindings = formatting_1.formatting.setFriendlyPermissions(r.RoleDefinitionBindings);
@@ -90,6 +96,8 @@ _SpoListItemGetCommand_instances = new WeakSet(), _SpoListItemGetCommand_initTel
90
96
  listId: typeof args.options.listId !== 'undefined',
91
97
  listTitle: typeof args.options.listTitle !== 'undefined',
92
98
  listUrl: typeof args.options.listUrl !== 'undefined',
99
+ id: typeof args.options.id !== 'undefined',
100
+ uniqueId: typeof args.options.uniqueId !== 'undefined',
93
101
  withPermissions: !!args.options.withPermissions
94
102
  });
95
103
  });
@@ -97,7 +105,9 @@ _SpoListItemGetCommand_instances = new WeakSet(), _SpoListItemGetCommand_initTel
97
105
  this.options.unshift({
98
106
  option: '-u, --webUrl <webUrl>'
99
107
  }, {
100
- option: '-i, --id <id>'
108
+ option: '-i, --id [id]'
109
+ }, {
110
+ option: '--uniqueId [uniqueId]'
101
111
  }, {
102
112
  option: '-l, --listId [listId]'
103
113
  }, {
@@ -119,15 +129,20 @@ _SpoListItemGetCommand_instances = new WeakSet(), _SpoListItemGetCommand_initTel
119
129
  !validation_1.validation.isValidGuid(args.options.listId)) {
120
130
  return `${args.options.listId} in option listId is not a valid GUID`;
121
131
  }
122
- if (isNaN(parseInt(args.options.id))) {
132
+ if (args.options.id &&
133
+ isNaN(parseInt(args.options.id))) {
123
134
  return `${args.options.id} is not a number`;
124
135
  }
136
+ if (args.options.uniqueId &&
137
+ !validation_1.validation.isValidGuid(args.options.uniqueId)) {
138
+ return `${args.options.uniqueId} in option uniqueId is not a valid GUID`;
139
+ }
125
140
  return true;
126
141
  }));
127
142
  }, _SpoListItemGetCommand_initTypes = function _SpoListItemGetCommand_initTypes() {
128
- this.types.string.push('webUrl', 'listId', 'listTitle', 'id', 'properties');
143
+ this.types.string.push('webUrl', 'listId', 'listTitle', 'id', 'uniqueId', 'properties');
129
144
  }, _SpoListItemGetCommand_initOptionSets = function _SpoListItemGetCommand_initOptionSets() {
130
- this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] });
145
+ this.optionSets.push({ options: ['listId', 'listTitle', 'listUrl'] }, { options: ['id', 'uniqueId'] });
131
146
  };
132
147
  module.exports = new SpoListItemGetCommand();
133
148
  //# sourceMappingURL=listitem-get.js.map
@@ -42,6 +42,9 @@ class SpoListItemRetentionLabelEnsureCommand extends SpoCommand_1.default {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
43
  try {
44
44
  const labelInformation = yield this.getLabelInformation(args.options, logger);
45
+ if (args.options.assetId) {
46
+ yield this.applyAssetId(args.options, logger);
47
+ }
45
48
  yield this.applyLabel(args.options, labelInformation, logger);
46
49
  }
47
50
  catch (err) {
@@ -106,6 +109,34 @@ class SpoListItemRetentionLabelEnsureCommand extends SpoCommand_1.default {
106
109
  yield request_1.default.post(requestOptions);
107
110
  });
108
111
  }
112
+ applyAssetId(options, logger) {
113
+ return __awaiter(this, void 0, void 0, function* () {
114
+ if (this.verbose) {
115
+ logger.logToStderr(`Applying the asset Id ${options.assetId}...`);
116
+ }
117
+ let requestUrl = `${options.webUrl}/_api/web`;
118
+ if (options.listId) {
119
+ requestUrl += `/lists(guid'${formatting_1.formatting.encodeQueryParameter(options.listId)}')/items(${options.listItemId})/ValidateUpdateListItem()`;
120
+ }
121
+ else if (options.listTitle) {
122
+ requestUrl += `/lists/getByTitle('${formatting_1.formatting.encodeQueryParameter(options.listTitle)}')/items(${options.listItemId})/ValidateUpdateListItem()`;
123
+ }
124
+ else if (options.listUrl) {
125
+ const listServerRelativeUrl = urlUtil_1.urlUtil.getServerRelativePath(options.webUrl, options.listUrl);
126
+ requestUrl += `/GetList(@listUrl)/items(${options.listItemId})/ValidateUpdateListItem()?@listUrl='${formatting_1.formatting.encodeQueryParameter(listServerRelativeUrl)}'`;
127
+ }
128
+ const requestBody = { "formValues": [{ "FieldName": "ComplianceAssetId", "FieldValue": options.assetId }] };
129
+ const requestOptions = {
130
+ url: requestUrl,
131
+ headers: {
132
+ 'accept': 'application/json;odata=nometadata'
133
+ },
134
+ data: requestBody,
135
+ responseType: 'json'
136
+ };
137
+ yield request_1.default.post(requestOptions);
138
+ });
139
+ }
109
140
  }
110
141
  _SpoListItemRetentionLabelEnsureCommand_instances = new WeakSet(), _SpoListItemRetentionLabelEnsureCommand_initTelemetry = function _SpoListItemRetentionLabelEnsureCommand_initTelemetry() {
111
142
  this.telemetry.push((args) => {
@@ -114,7 +145,8 @@ _SpoListItemRetentionLabelEnsureCommand_instances = new WeakSet(), _SpoListItemR
114
145
  listTitle: typeof args.options.listTitle !== 'undefined',
115
146
  listUrl: typeof args.options.listUrl !== 'undefined',
116
147
  name: typeof args.options.name !== 'undefined',
117
- id: typeof args.options.id !== 'undefined'
148
+ id: typeof args.options.id !== 'undefined',
149
+ assetId: typeof args.options.assetId !== 'undefined'
118
150
  });
119
151
  });
120
152
  }, _SpoListItemRetentionLabelEnsureCommand_initOptions = function _SpoListItemRetentionLabelEnsureCommand_initOptions() {
@@ -132,6 +164,8 @@ _SpoListItemRetentionLabelEnsureCommand_instances = new WeakSet(), _SpoListItemR
132
164
  option: '-n, --name [name]'
133
165
  }, {
134
166
  option: '-i, --id [id]'
167
+ }, {
168
+ option: '-a, --assetId [assetId]'
135
169
  });
136
170
  }, _SpoListItemRetentionLabelEnsureCommand_initValidators = function _SpoListItemRetentionLabelEnsureCommand_initValidators() {
137
171
  this.validators.push((args) => __awaiter(this, void 0, void 0, function* () {
@@ -69,20 +69,37 @@ class SpoWebSetCommand extends SpoCommand_1.default {
69
69
  const searchScope = args.options.searchScope.toLowerCase();
70
70
  payload.SearchScope = SpoWebSetCommand.searchScopeOptions.indexOf(searchScope);
71
71
  }
72
- const requestOptions = {
73
- url: `${args.options.url}/_api/web`,
74
- headers: {
75
- 'content-type': 'application/json;odata=nometadata',
76
- accept: 'application/json;odata=nometadata'
77
- },
78
- responseType: 'json',
79
- data: payload
80
- };
81
- if (this.verbose) {
82
- logger.logToStderr(`Updating properties of subsite ${args.options.url}...`);
83
- }
84
72
  try {
73
+ const requestOptions = {
74
+ url: `${args.options.url}/_api/web`,
75
+ headers: {
76
+ 'content-type': 'application/json;odata=nometadata',
77
+ accept: 'application/json;odata=nometadata'
78
+ },
79
+ responseType: 'json',
80
+ data: payload
81
+ };
82
+ if (this.verbose) {
83
+ logger.logToStderr(`Updating properties of subsite ${args.options.url}...`);
84
+ }
85
85
  yield request_1.default.patch(requestOptions);
86
+ if (typeof args.options.welcomePage !== 'undefined') {
87
+ if (this.verbose) {
88
+ logger.logToStderr(`Setting welcome page to: ${args.options.welcomePage}...`);
89
+ }
90
+ const requestOptions = {
91
+ url: `${args.options.url}/_api/web/RootFolder`,
92
+ headers: {
93
+ 'content-type': 'application/json;odata=nometadata',
94
+ accept: 'application/json;odata=nometadata'
95
+ },
96
+ responseType: 'json',
97
+ data: {
98
+ WelcomePage: args.options.welcomePage
99
+ }
100
+ };
101
+ yield request_1.default.patch(requestOptions);
102
+ }
86
103
  }
87
104
  catch (err) {
88
105
  this.handleRejectedODataJsonPromise(err);
@@ -105,7 +122,8 @@ _SpoWebSetCommand_instances = new WeakSet(), _SpoWebSetCommand_initTelemetry = f
105
122
  quickLaunchEnabled: typeof args.options.quickLaunchEnabled !== 'undefined',
106
123
  footerEnabled: typeof args.options.footerEnabled !== 'undefined',
107
124
  navAudienceTargetingEnabled: typeof args.options.navAudienceTargetingEnabled !== 'undefined',
108
- searchScope: args.options.searchScope !== 'undefined'
125
+ searchScope: typeof args.options.searchScope !== 'undefined',
126
+ welcomePage: typeof args.options.welcomePage !== 'undefined'
109
127
  });
110
128
  this.trackUnknownOptions(this.telemetryProperties, args.options);
111
129
  });
@@ -139,6 +157,8 @@ _SpoWebSetCommand_instances = new WeakSet(), _SpoWebSetCommand_initTelemetry = f
139
157
  }, {
140
158
  option: '--searchScope [searchScope]',
141
159
  autocomplete: SpoWebSetCommand.searchScopeOptions
160
+ }, {
161
+ option: '--welcomePage [welcomePage]'
142
162
  });
143
163
  }, _SpoWebSetCommand_initTypes = function _SpoWebSetCommand_initTypes() {
144
164
  this.types.boolean.push('megaMenuEnabled', 'footerEnabled', 'quickLaunchEnabled', 'navAudienceTargetingEnabled');
@@ -15,7 +15,8 @@ const settingsNames = {
15
15
  output: 'output',
16
16
  printErrorsAsPlainText: 'printErrorsAsPlainText',
17
17
  prompt: 'prompt',
18
- showHelpOnFailure: 'showHelpOnFailure'
18
+ showHelpOnFailure: 'showHelpOnFailure',
19
+ showSpinner: 'showSpinner'
19
20
  };
20
21
  exports.settingsNames = settingsNames;
21
22
  //# sourceMappingURL=settingsNames.js.map
@@ -18,3 +18,4 @@ Setting name|Definition|Default value
18
18
  `printErrorsAsPlainText`|When output mode is set to `json`, print error messages as plain-text rather than JSON|`true`
19
19
  `prompt`|Prompts for missing values in required options|`false`
20
20
  `showHelpOnFailure`|Automatically display help when executing a command failed|`true`
21
+ `showSpinner`|Display spinner when executing commands|`true`
@@ -0,0 +1,52 @@
1
+ # pa app export
2
+
3
+ Exports the specified Power App
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 pa app export [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-i, --id <id>`
14
+ : The id of the Power App to export
15
+
16
+ `-e, --environment <environment>`
17
+ : The name of the environment for which to export the app
18
+
19
+ `-n, --packageDisplayName [packageDisplayName]`
20
+ : The display name to use in the exported package
21
+
22
+ `-d, --packageDescription [packageDescription]`
23
+ : The description to use in the exported package
24
+
25
+ `-c, --packageCreatedBy [packageCreatedBy]`
26
+ : The name of the person to be used as the creator of the exported package
27
+
28
+ `-s, --packageSourceEnvironment [packageSourceEnvironment]`
29
+ : The name of the source environment from which the exported package was taken
30
+
31
+ `-p, --path [path]`
32
+ : The path to save the exported package to. If not specified the app will be exported in the current working directory
33
+
34
+ --8<-- "docs/cmd/_global.md"
35
+
36
+ ## Examples
37
+
38
+ Export the specified Power App as a ZIP file
39
+
40
+ ```sh
41
+ m365 pa app export --environment Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --id 3989cb59-ce1a-4a5c-bb78-257c5c39381d
42
+ ```
43
+
44
+ Export the specified Power App as a ZIP file with the package displayname, package description, the one who created it, the package source environment and the path
45
+
46
+ ```sh
47
+ m365 pa app export --environment Default-d87a7535-dd31-4437-bfe1-95340acd55c5 --id 3989cb59-ce1a-4a5c-bb78-257c5c39381d --packageDisplayName "PowerApp" --packageDescription "Power App Description" --packageCreatedBy "John Doe" --packageSourceEnvironment "Contoso" --path "C:/Users/John/Documents"
48
+ ```
49
+
50
+ ## Response
51
+
52
+ The command won't return a response on success.
@@ -0,0 +1,191 @@
1
+ # purview threatassessment get
2
+
3
+ Get a threat assessment
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 purview threatassessment get [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `-i, --id <id>`
14
+ : The Id of the threat assessment
15
+
16
+ `--includeResults`
17
+ : Include the threat assessment results
18
+
19
+ --8<-- "docs/cmd/_global.md"
20
+
21
+ ## Examples
22
+
23
+ Get a threat assessment
24
+
25
+ ```sh
26
+ m365 purview threatassessment get --id c37d695e-d581-4ae9-82a0-9364eba4291e
27
+ ```
28
+
29
+ Get a threat assessment including results
30
+
31
+ ```sh
32
+ m365 purview threatassessment get --id c37d695e-d581-4ae9-82a0-9364eba4291e --includeResults
33
+ ```
34
+
35
+ ## Response
36
+
37
+ ### Standard Response
38
+
39
+ === "JSON"
40
+
41
+ ```json
42
+ {
43
+ "id": "8aaba0ac-ec4d-4e62-5774-08db16c68731",
44
+ "createdDateTime": "2023-02-25T00:23:33.0550644Z",
45
+ "contentType": "mail",
46
+ "expectedAssessment": "block",
47
+ "category": "spam",
48
+ "status": "pending",
49
+ "requestSource": "administrator",
50
+ "recipientEmail": "john@contoso.com",
51
+ "destinationRoutingReason": "notJunk",
52
+ "messageUri": "https://graph.microsoft.com/v1.0/users/john@contoso.com/messages/AAMkADgzN2Q1NThiLTI0NjYtNGIxYS05MDdjLTg1OWQxNzgwZGM2ZgBGAAAAAAC6jQfUzacTSIHqMw2yacnUBwBiOC8xvYmdT6G2E_hLMK5kAAAAAAEMAABiOC8xvYmdT6G2E_hLMK5kAALHNaMuAAA=",
53
+ "createdBy": {
54
+ "user": {
55
+ "id": "fe36f75e-c103-410b-a18a-2bf6df06ac3a",
56
+ "displayName": "John Doe"
57
+ }
58
+ }
59
+ }
60
+ ```
61
+
62
+ === "Text"
63
+
64
+ ```text
65
+ category : spam
66
+ contentType : mail
67
+ createdBy : {"user":{"id":"fe36f75e-c103-410b-a18a-2bf6df06ac3a","displayName":"John Doe"}}
68
+ createdDateTime : 2023-02-25T00:23:33.0550644Z
69
+ destinationRoutingReason: notJunk
70
+ expectedAssessment : block
71
+ id : 8aaba0ac-ec4d-4e62-5774-08db16c68731
72
+ messageUri : https://graph.microsoft.com/v1.0/users/john@contoso.com/messages/AAMkADgzN2Q1NThiLTI0NjYtNGIxYS05MDdjLTg1OWQxNzgwZGM2ZgBGAAAAAAC6jQfUzacTSIHqMw2yacnUBwBiOC8xvYmdT6G2E_hLMK5kAAAAAAEMAABiOC8xvYmdT6G2E_hLMK5kAALHNaMuAAA=
73
+ recipientEmail : john@contoso.com
74
+ requestSource : administrator
75
+ status : pending
76
+ ```
77
+
78
+ === "CSV"
79
+
80
+ ```csv
81
+ id,createdDateTime,contentType,expectedAssessment,category,status,requestSource,recipientEmail,destinationRoutingReason,messageUri,createdBy
82
+ 8aaba0ac-ec4d-4e62-5774-08db16c68731,2023-02-25T00:23:33.0550644Z,mail,block,spam,pending,administrator,john@contoso.com,notJunk,https://graph.microsoft.com/v1.0/users/john@contoso.com/messages/AAMkADgzN2Q1NThiLTI0NjYtNGIxYS05MDdjLTg1OWQxNzgwZGM2ZgBGAAAAAAC6jQfUzacTSIHqMw2yacnUBwBiOC8xvYmdT6G2E_hLMK5kAAAAAAEMAABiOC8xvYmdT6G2E_hLMK5kAALHNaMuAAA=,"{""user"":{""id"":""fe36f75e-c103-410b-a18a-2bf6df06ac3a"",""displayName"":""John Doe""}}"
83
+ ```
84
+
85
+ === "Markdown"
86
+
87
+ ```md
88
+ # purview threatassessment get --id "8aaba0ac-ec4d-4e62-5774-08db16c68731"
89
+
90
+ Date: 25/02/2023
91
+
92
+ ## 8aaba0ac-ec4d-4e62-5774-08db16c68731
93
+
94
+ Property | Value
95
+ ---------|-------
96
+ id | 8aaba0ac-ec4d-4e62-5774-08db16c68731
97
+ createdDateTime | 2023-02-25T00:23:33.0550644Z
98
+ contentType | mail
99
+ expectedAssessment | block
100
+ category | spam
101
+ status | pending
102
+ requestSource | administrator
103
+ recipientEmail | john@contoso.com
104
+ destinationRoutingReason | notJunk
105
+ messageUri | https://graph.microsoft.com/v1.0/users/john@contoso.com/messages/AAMkADgzN2Q1NThiLTI0NjYtNGIxYS05MDdjLTg1OWQxNzgwZGM2ZgBGAAAAAAC6jQfUzacTSIHqMw2yacnUBwBiOC8xvYmdT6G2E\_hLMK5kAAAAAAEMAABiOC8xvYmdT6G2E\_hLMK5kAALHNaMuAAA=
106
+ createdBy | {"user":{"id":"fe36f75e-c103-410b-a18a-2bf6df06ac3a","displayName":"John Doe"}}
107
+ ```
108
+
109
+ ### `includeResults` response
110
+
111
+ When we make use of the option `includeResults` the response will differ.
112
+
113
+ === "JSON"
114
+
115
+ ```json
116
+ {
117
+ "id": "8aaba0ac-ec4d-4e62-5774-08db16c68731",
118
+ "createdDateTime": "2023-02-25T00:23:33.0550644Z",
119
+ "contentType": "mail",
120
+ "expectedAssessment": "block",
121
+ "category": "spam",
122
+ "status": "pending",
123
+ "requestSource": "administrator",
124
+ "recipientEmail": "john@contoso.com",
125
+ "destinationRoutingReason": "notJunk",
126
+ "messageUri": "https://graph.microsoft.com/v1.0/users/john@contoso.com/messages/AAMkADgzN2Q1NThiLTI0NjYtNGIxYS05MDdjLTg1OWQxNzgwZGM2ZgBGAAAAAAC6jQfUzacTSIHqMw2yacnUBwBiOC8xvYmdT6G2E_hLMK5kAAAAAAEMAABiOC8xvYmdT6G2E_hLMK5kAALHNaMuAAA=",
127
+ "createdBy": {
128
+ "user": {
129
+ "id": "fe36f75e-c103-410b-a18a-2bf6df06ac3a",
130
+ "displayName": "John Doe"
131
+ }
132
+ },
133
+ "results": [
134
+ {
135
+ "id": "a5455871-18d1-44d8-0866-08db16c68b85",
136
+ "createdDateTime": "2023-02-25T00:23:40.28Z",
137
+ "resultType": "checkPolicy",
138
+ "message": "No policy was hit."
139
+ }
140
+ ]
141
+ }
142
+ ```
143
+
144
+ === "Text"
145
+
146
+ ```text
147
+ category : spam
148
+ contentType : mail
149
+ createdBy : {"user":{"id":"fe36f75e-c103-410b-a18a-2bf6df06ac3a","displayName":"John Doe"}}
150
+ createdDateTime : 2023-02-25T00:23:33.0550644Z
151
+ destinationRoutingReason: notJunk
152
+ expectedAssessment : block
153
+ id : 8aaba0ac-ec4d-4e62-5774-08db16c68731
154
+ messageUri : https://graph.microsoft.com/v1.0/users/john@contoso.com/messages/AAMkADgzN2Q1NThiLTI0NjYtNGIxYS05MDdjLTg1OWQxNzgwZGM2ZgBGAAAAAAC6jQfUzacTSIHqMw2yacnUBwBiOC8xvYmdT6G2E_hLMK5kAAAAAAEMAABiOC8xvYmdT6G2E_hLMK5kAALHNaMuAAA=
155
+ recipientEmail : john@contoso.com
156
+ requestSource : administrator
157
+ results : [{"id":"a5455871-18d1-44d8-0866-08db16c68b85","createdDateTime":"2023-02-25T00:23:40.28Z","resultType":"checkPolicy","message":"No policy was hit."}]
158
+ status : pending
159
+ ```
160
+
161
+ === "CSV"
162
+
163
+ ```csv
164
+ id,createdDateTime,contentType,expectedAssessment,category,status,requestSource,recipientEmail,destinationRoutingReason,messageUri,createdBy,results
165
+ 8aaba0ac-ec4d-4e62-5774-08db16c68731,2023-02-25T00:23:33.0550644Z,mail,block,spam,pending,administrator,john@contoso.com,notJunk,https://graph.microsoft.com/v1.0/users/john@contoso.com/messages/AAMkADgzN2Q1NThiLTI0NjYtNGIxYS05MDdjLTg1OWQxNzgwZGM2ZgBGAAAAAAC6jQfUzacTSIHqMw2yacnUBwBiOC8xvYmdT6G2E_hLMK5kAAAAAAEMAABiOC8xvYmdT6G2E_hLMK5kAALHNaMuAAA=,"{""user"":{""id"":""fe36f75e-c103-410b-a18a-2bf6df06ac3a"",""displayName"":""John Doe""}}","[{""id"":""a5455871-18d1-44d8-0866-08db16c68b85"",""createdDateTime"":""2023-02-25T00:23:40.28Z"",""resultType"":""checkPolicy"",""message"":""No policy was hit.""}]"
166
+ ```
167
+
168
+ === "Markdown"
169
+
170
+ ```md
171
+ # purview threatassessment get --id "8aaba0ac-ec4d-4e62-5774-08db16c68731" --includeResults "true"
172
+
173
+ Date: 25/02/2023
174
+
175
+ ## 8aaba0ac-ec4d-4e62-5774-08db16c68731
176
+
177
+ Property | Value
178
+ ---------|-------
179
+ id | 8aaba0ac-ec4d-4e62-5774-08db16c68731
180
+ createdDateTime | 2023-02-25T00:23:33.0550644Z
181
+ contentType | mail
182
+ expectedAssessment | block
183
+ category | spam
184
+ status | pending
185
+ requestSource | administrator
186
+ recipientEmail | john@contoso.com
187
+ destinationRoutingReason | notJunk
188
+ messageUri | https://graph.microsoft.com/v1.0/users/john@contoso.com/messages/AAMkADgzN2Q1NThiLTI0NjYtNGIxYS05MDdjLTg1OWQxNzgwZGM2ZgBGAAAAAAC6jQfUzacTSIHqMw2yacnUBwBiOC8xvYmdT6G2E\_hLMK5kAAAAAAEMAABiOC8xvYmdT6G2E\_hLMK5kAALHNaMuAAA=
189
+ createdBy | {"user":{"id":"fe36f75e-c103-410b-a18a-2bf6df06ac3a","displayName":"John Doe"}}
190
+ results | [{"id":"a5455871-18d1-44d8-0866-08db16c68b85","createdDateTime":"2023-02-25T00:23:40.28Z","resultType":"checkPolicy","message":"No policy was hit."}]
191
+ ```
@@ -22,12 +22,17 @@ m365 spo file retentionlabel ensure [options]
22
22
  `--name <name>`
23
23
  : Name of the retention label to apply to the file.
24
24
 
25
+ `-a, --assetId [assetId]`
26
+ : A Compliance Asset Id to set on the item when it's labeled. See below for more information.
27
+
25
28
  --8<-- "docs/cmd/_global.md"
26
29
 
27
30
  ## Remarks
28
31
 
29
32
  You can also use [spo listitem retentionlabel remove](./../../../cmd/spo//listitem/listitem-retentionlabel-remove.md) for removing the retentionlabel from a listitem.
30
33
 
34
+ The `--assetId` option has to do with event-based retention. Event-based retention is about starting a retention period when a specific event occurs, instead of the moment a document was labeled or created.
35
+
31
36
  ## Examples
32
37
 
33
38
  Applies a retention label to a file based on the label name and the fileUrl
@@ -39,7 +44,13 @@ m365 spo file retentionlabel ensure --webUrl https://contoso.sharepoint.com/site
39
44
  Applies a retention label to a file based on the label name and the fileId
40
45
 
41
46
  ```sh
42
- m365 spo file retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --fileId '26541f96-017c-4189-a604-599e083533b8' --name 'Some label'
47
+ m365 spo file retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --fileId '26541f96-017c-4189-a604-599e083533b8' --name 'Some label'
48
+ ```
49
+
50
+ Applies a event-based retention label to a file and updates the Asset Id field
51
+
52
+ ```sh
53
+ m365 spo file retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --fileId '26541f96-017c-4189-a604-599e083533b8' --name 'Some label' --assetId 'XYZ'
43
54
  ```
44
55
 
45
56
  ## Response
@@ -13,17 +13,20 @@ m365 spo listitem get [options]
13
13
  `-u, --webUrl <webUrl>`
14
14
  : URL of the site where the item is located.
15
15
 
16
- `-i, --id <id>`
17
- : ID of the item to retrieve.
16
+ `-i, --id [id]`
17
+ : ID of the item to retrieve. Specify either `id` or `uniqueId` but not both.
18
+
19
+ `--uniqueId [uniqueId]`
20
+ : The Unique ID (GUID) of the item to retrieve. Specify either `id` or `uniqueId` but not both.
18
21
 
19
22
  `-l, --listId [listId]`
20
- : ID of the list. Specify either `listTitle`, `listId` or `listUrl` but not multiple.
23
+ : ID of the list. Specify either `listTitle`, `listId`, or `listUrl` but not multiple.
21
24
 
22
25
  `-t, --listTitle [listTitle]`
23
- : Title of the list. Specify either `listTitle`, `listId` or `listUrl` but not multiple.
26
+ : Title of the list. Specify either `listTitle`, `listId`, or `listUrl` but not multiple.
24
27
 
25
28
  `--listUrl [listUrl]`
26
- : Server- or site-relative URL of the list. Specify either `listTitle`, `listId` or `listUrl` but not multiple.
29
+ : Server- or site-relative URL of the list. Specify either `listTitle`, `listId`, or `listUrl` but not multiple.
27
30
 
28
31
  `-p, --properties [properties]`
29
32
  : Comma-separated list of properties to retrieve. Will retrieve all properties if not specified and json output is requested.
@@ -45,6 +48,12 @@ Get an item with the ID parameter from a given list in a given site.
45
48
  m365 spo listitem get --listTitle "Demo List" --id 147 --webUrl https://contoso.sharepoint.com/sites/project-x
46
49
  ```
47
50
 
51
+ Get an item with the Unique ID parameter from a given list in a given site.
52
+
53
+ ```sh
54
+ m365 spo listitem get --listTitle "Demo List" --uniqueId "64dc28c4-3c43-45f6-ba66-307d9eb7e6aa" --webUrl https://contoso.sharepoint.com/sites/project-x
55
+ ```
56
+
48
57
  Get an item columns with the ID parameter from a given list in a given site.
49
58
 
50
59
  ```sh
@@ -31,11 +31,18 @@ m365 spo listitem retentionlabel ensure [options]
31
31
  `-i, --id [id]`
32
32
  : The id of the retention label. Specify either `name` or `id`.
33
33
 
34
+ `-a, --assetId [assetId]`
35
+ : A Compliance Asset Id to set on the item when it's labeled. See below for more information.
36
+
34
37
  --8<-- "docs/cmd/_global.md"
35
38
 
39
+ ## Remarks
40
+
41
+ The `--assetId` option has to do with event-based retention. Event-based retention is about starting a retention period when a specific event occurs, instead of the moment a document was labeled or created.
42
+
36
43
  ## Examples
37
44
 
38
- Applies the retention label _Some label_ to a list item in a given site based on the list id and label name
45
+ Applies a retention label to a list item in a given site based on the list id and label name
39
46
 
40
47
  ```sh
41
48
  m365 spo listitem retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listId 0cd891ef-afce-4e55-b836-fce03286cccf --listItemId 1 --name 'Some label'
@@ -47,12 +54,18 @@ Applies a retention label to a list item in a given site based on the list title
47
54
  m365 spo listitem retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listTitle 'List 1' --listItemId 1 --id '7a621a91-063b-461b-aff6-d713d5fb23eb'
48
55
  ```
49
56
 
50
- Applies the retention label _Some label_ to a list item in a given site based on the server relative list url
57
+ Applies a retention label to a list item in a given site based on the server relative list url
51
58
 
52
59
  ```sh
53
60
  m365 spo listitem retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl /sites/project-x/lists/TestList --listItemId 1 --name 'Some label'
54
61
  ```
55
62
 
63
+ Applies a retention label to a list item in a given site based on the server relative list url and updates the Asset Id field
64
+
65
+ ```sh
66
+ m365 spo listitem retentionlabel ensure --webUrl https://contoso.sharepoint.com/sites/project-x --listUrl /sites/project-x/lists/TestList --listItemId 1 --name 'Some label' --assetId 'XYZ'
67
+ ```
68
+
56
69
  ## Response
57
70
 
58
71
  The command won't return a response on success.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "6.5.0-beta.33bab12",
3
+ "version": "6.5.0-beta.ccd8e85",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",