@pnp/cli-microsoft365 5.4.0 → 5.5.0-beta.42585c2

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/dist/Auth.js CHANGED
@@ -330,7 +330,7 @@ class Auth {
330
330
  }
331
331
  return this.clientApplication.acquireTokenByUsernamePassword({
332
332
  username: this.service.userName,
333
- password: encodeURIComponent(this.service.password),
333
+ password: this.service.password,
334
334
  scopes: [`${resource}/.default`]
335
335
  });
336
336
  });
@@ -96,6 +96,9 @@ class FlowExportCommand extends AzmgmtCommand_1.default {
96
96
  const downloadFileUrl = formatArgument === 'json' ? '' : res.packageLink.value;
97
97
  const filenameRegEx = /([^\/]+\.zip)/i;
98
98
  filenameFromApi = formatArgument === 'json' ? `${res.properties.displayName}.json` : (filenameRegEx.exec(downloadFileUrl) || ['output.zip'])[0];
99
+ // Replace all illegal characters from the file name
100
+ const illegalCharsRegEx = /[\\\/:*?"<>|]/g;
101
+ filenameFromApi = filenameFromApi.replace(illegalCharsRegEx, '_');
99
102
  if (this.debug) {
100
103
  logger.logToStderr(`Filename from PowerApps API: ${filenameFromApi}`);
101
104
  logger.logToStderr('');
@@ -6,15 +6,21 @@ const GraphCommand_1 = require("../../../base/GraphCommand");
6
6
  const commands_1 = require("../../commands");
7
7
  const Auth_1 = require("../../../../Auth");
8
8
  const aadGroup_1 = require("../../../../utils/aadGroup");
9
+ const request_1 = require("../../../../request");
9
10
  class PlannerPlanGetCommand extends GraphCommand_1.default {
10
11
  get name() {
11
12
  return commands_1.default.PLAN_GET;
12
13
  }
14
+ alias() {
15
+ return [commands_1.default.PLAN_DETAILS_GET];
16
+ }
13
17
  get description() {
14
18
  return 'Get a Microsoft Planner plan';
15
19
  }
16
20
  getTelemetryProperties(args) {
17
21
  const telemetryProps = super.getTelemetryProperties(args);
22
+ telemetryProps.planId = typeof args.options.planId !== 'undefined';
23
+ telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
18
24
  telemetryProps.id = typeof args.options.id !== 'undefined';
19
25
  telemetryProps.title = typeof args.options.title !== 'undefined';
20
26
  telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
@@ -25,13 +31,21 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
25
31
  return ['id', 'title', 'createdDateTime', 'owner', '@odata.etag'];
26
32
  }
27
33
  commandAction(logger, args, cb) {
34
+ this.showDeprecationWarning(logger, commands_1.default.PLAN_DETAILS_GET, commands_1.default.PLAN_GET);
28
35
  if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
29
36
  this.handleError('This command does not support application permissions.', logger, cb);
30
37
  return;
31
38
  }
39
+ if (args.options.planId) {
40
+ args.options.id = args.options.planId;
41
+ }
42
+ if (args.options.planTitle) {
43
+ args.options.title = args.options.planTitle;
44
+ }
32
45
  if (args.options.id) {
33
46
  planner_1.planner
34
47
  .getPlanById(args.options.id)
48
+ .then(plan => this.getPlanDetails(plan))
35
49
  .then((res) => {
36
50
  logger.log(res);
37
51
  cb();
@@ -41,14 +55,30 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
41
55
  this
42
56
  .getGroupId(args)
43
57
  .then(groupId => planner_1.planner.getPlanByName(args.options.title, groupId))
44
- .then((plan) => {
45
- if (plan) {
46
- logger.log(plan);
58
+ .then(plan => this.getPlanDetails(plan))
59
+ .then((res) => {
60
+ if (res) {
61
+ logger.log(res);
47
62
  }
48
63
  cb();
49
64
  }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
50
65
  }
51
66
  }
67
+ getPlanDetails(plan) {
68
+ const requestOptionsTaskDetails = {
69
+ url: `${this.resource}/v1.0/planner/plans/${plan.id}/details`,
70
+ headers: {
71
+ 'accept': 'application/json;odata.metadata=none',
72
+ 'Prefer': 'return=representation'
73
+ },
74
+ responseType: 'json'
75
+ };
76
+ return request_1.default
77
+ .get(requestOptionsTaskDetails)
78
+ .then(planDetails => {
79
+ return Object.assign(Object.assign({}, plan), planDetails);
80
+ });
81
+ }
52
82
  getGroupId(args) {
53
83
  if (args.options.ownerGroupId) {
54
84
  return Promise.resolve(args.options.ownerGroupId);
@@ -59,6 +89,12 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
59
89
  }
60
90
  options() {
61
91
  const options = [
92
+ {
93
+ option: '--planId [planId]'
94
+ },
95
+ {
96
+ option: '--planTitle [planTitle]'
97
+ },
62
98
  {
63
99
  option: '-i, --id [id]'
64
100
  },
@@ -76,20 +112,25 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
76
112
  return options.concat(parentOptions);
77
113
  }
78
114
  validate(args) {
79
- if (!args.options.id && !args.options.title) {
80
- return 'Specify either id or title';
81
- }
82
- if (args.options.id && args.options.title) {
83
- return 'Specify either id or title';
84
- }
85
- if (args.options.title && !args.options.ownerGroupId && !args.options.ownerGroupName) {
86
- return 'Specify either ownerGroupId or ownerGroupName';
87
- }
88
- if (args.options.title && args.options.ownerGroupId && args.options.ownerGroupName) {
89
- return 'Specify either ownerGroupId or ownerGroupName but not both';
115
+ if (args.options.planId && args.options.planTitle ||
116
+ args.options.id && args.options.title ||
117
+ args.options.planId && args.options.title ||
118
+ args.options.id && args.options.planTitle) {
119
+ return 'Specify either id or title but not both';
90
120
  }
91
- if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
92
- return `${args.options.ownerGroupId} is not a valid GUID`;
121
+ if (!args.options.planId && !args.options.id) {
122
+ if (!args.options.planTitle && !args.options.title) {
123
+ return 'Specify either id or title';
124
+ }
125
+ if ((args.options.title || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
126
+ return 'Specify either ownerGroupId or ownerGroupName';
127
+ }
128
+ if ((args.options.title || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
129
+ return 'Specify either ownerGroupId or ownerGroupName but not both';
130
+ }
131
+ if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
132
+ return `${args.options.ownerGroupId} is not a valid GUID`;
133
+ }
93
134
  }
94
135
  return true;
95
136
  }
@@ -0,0 +1,141 @@
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 Auth_1 = require("../../../../Auth");
13
+ const cli_1 = require("../../../../cli");
14
+ const request_1 = require("../../../../request");
15
+ const utils_1 = require("../../../../utils");
16
+ const aadGroup_1 = require("../../../../utils/aadGroup");
17
+ const planner_1 = require("../../../../utils/planner");
18
+ const GraphCommand_1 = require("../../../base/GraphCommand");
19
+ const commands_1 = require("../../commands");
20
+ class PlannerPlanRemoveCommand extends GraphCommand_1.default {
21
+ get name() {
22
+ return commands_1.default.PLAN_REMOVE;
23
+ }
24
+ get description() {
25
+ return 'Removes the Microsoft Planner plan';
26
+ }
27
+ getTelemetryProperties(args) {
28
+ const telemetryProps = super.getTelemetryProperties(args);
29
+ telemetryProps.id = typeof args.options.id !== 'undefined';
30
+ telemetryProps.title = typeof args.options.title !== 'undefined';
31
+ telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
32
+ telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
33
+ telemetryProps.confirm = !!args.options.confirm;
34
+ return telemetryProps;
35
+ }
36
+ commandAction(logger, args, cb) {
37
+ if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
38
+ this.handleError('This command does not support application permissions.', logger, cb);
39
+ return;
40
+ }
41
+ const removePlan = () => __awaiter(this, void 0, void 0, function* () {
42
+ try {
43
+ const plan = yield this.getPlan(args);
44
+ const requestOptions = {
45
+ url: `${this.resource}/v1.0/planner/plans/${plan.id}`,
46
+ headers: {
47
+ accept: 'application/json;odata.metadata=none',
48
+ 'if-match': plan['@odata.etag']
49
+ },
50
+ responseType: 'json'
51
+ };
52
+ yield request_1.default.delete(requestOptions);
53
+ cb();
54
+ }
55
+ catch (err) {
56
+ this.handleRejectedODataJsonPromise(err, logger, cb);
57
+ }
58
+ });
59
+ if (args.options.confirm) {
60
+ removePlan();
61
+ }
62
+ else {
63
+ cli_1.Cli.prompt({
64
+ type: 'confirm',
65
+ name: 'continue',
66
+ default: false,
67
+ message: `Are you sure you want to remove the plan ${args.options.id || args.options.title}?`
68
+ }, (result) => {
69
+ if (!result.continue) {
70
+ cb();
71
+ }
72
+ else {
73
+ removePlan();
74
+ }
75
+ });
76
+ }
77
+ }
78
+ getPlan(args) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ const { id, title } = args.options;
81
+ if (id) {
82
+ return planner_1.planner.getPlanById(id, 'minimal');
83
+ }
84
+ const groupId = yield this.getGroupId(args);
85
+ return yield planner_1.planner.getPlanByName(title, groupId);
86
+ });
87
+ }
88
+ getGroupId(args) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ const { ownerGroupId, ownerGroupName } = args.options;
91
+ if (ownerGroupId) {
92
+ return ownerGroupId;
93
+ }
94
+ const group = yield aadGroup_1.aadGroup.getGroupByDisplayName(ownerGroupName);
95
+ return group.id;
96
+ });
97
+ }
98
+ optionSets() {
99
+ return [['id', 'title']];
100
+ }
101
+ options() {
102
+ const options = [
103
+ {
104
+ option: '-i, --id [id]'
105
+ },
106
+ {
107
+ option: '-t, --title [title]'
108
+ },
109
+ {
110
+ option: '--ownerGroupId [ownerGroupId]'
111
+ },
112
+ {
113
+ option: '--ownerGroupName [ownerGroupName]'
114
+ },
115
+ {
116
+ option: '--confirm'
117
+ }
118
+ ];
119
+ const parentOptions = super.options();
120
+ return options.concat(parentOptions);
121
+ }
122
+ validate(args) {
123
+ if (args.options.title) {
124
+ if (!args.options.ownerGroupId && !args.options.ownerGroupName) {
125
+ return 'Specify either ownerGroupId or ownerGroupName';
126
+ }
127
+ if (args.options.ownerGroupId && args.options.ownerGroupName) {
128
+ return 'Specify either ownerGroupId or ownerGroupName but not both';
129
+ }
130
+ if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
131
+ return `${args.options.ownerGroupId} is not a valid GUID`;
132
+ }
133
+ }
134
+ else if (args.options.ownerGroupId || args.options.ownerGroupName) {
135
+ return 'Don\'t specify ownerGroupId or ownerGroupName when using id';
136
+ }
137
+ return true;
138
+ }
139
+ }
140
+ module.exports = new PlannerPlanRemoveCommand();
141
+ //# sourceMappingURL=plan-remove.js.map
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../../../../utils");
4
+ const request_1 = require("../../../../request");
5
+ const PlannerCommand_1 = require("../../../base/PlannerCommand");
6
+ const commands_1 = require("../../commands");
7
+ class PlannerTenantSettingsSetCommand extends PlannerCommand_1.default {
8
+ get name() {
9
+ return commands_1.default.TENANT_SETTINGS_SET;
10
+ }
11
+ get description() {
12
+ return 'Sets Microsoft Planner configuration of the tenant';
13
+ }
14
+ getTelemetryProperties(args) {
15
+ const telemetryProps = super.getTelemetryProperties(args);
16
+ telemetryProps.isPlannerAllowed = typeof args.options.isPlannerAllowed !== 'undefined';
17
+ telemetryProps.allowCalendarSharing = typeof args.options.allowCalendarSharing !== 'undefined';
18
+ telemetryProps.allowTenantMoveWithDataLoss = typeof args.options.allowTenantMoveWithDataLoss !== 'undefined';
19
+ telemetryProps.allowTenantMoveWithDataMigration = typeof args.options.allowTenantMoveWithDataMigration !== 'undefined';
20
+ telemetryProps.allowRosterCreation = typeof args.options.allowRosterCreation !== 'undefined';
21
+ telemetryProps.allowPlannerMobilePushNotifications = typeof args.options.allowPlannerMobilePushNotifications !== 'undefined';
22
+ return telemetryProps;
23
+ }
24
+ commandAction(logger, args, cb) {
25
+ const requestOptions = {
26
+ url: `${this.resource}/taskAPI/tenantAdminSettings/Settings`,
27
+ headers: {
28
+ accept: 'application/json;odata.metadata=none',
29
+ prefer: 'return=representation'
30
+ },
31
+ responseType: 'json',
32
+ data: {
33
+ isPlannerAllowed: args.options.isPlannerAllowed,
34
+ allowCalendarSharing: args.options.allowCalendarSharing,
35
+ allowTenantMoveWithDataLoss: args.options.allowTenantMoveWithDataLoss,
36
+ allowTenantMoveWithDataMigration: args.options.allowTenantMoveWithDataMigration,
37
+ allowRosterCreation: args.options.allowRosterCreation,
38
+ allowPlannerMobilePushNotifications: args.options.allowPlannerMobilePushNotifications
39
+ }
40
+ };
41
+ request_1.default
42
+ .patch(requestOptions)
43
+ .then((result) => {
44
+ logger.log(result);
45
+ cb();
46
+ }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
47
+ }
48
+ options() {
49
+ const options = [
50
+ {
51
+ option: '--isPlannerAllowed [isPlannerAllowed]',
52
+ autocomplete: ['true', 'false']
53
+ },
54
+ {
55
+ option: '--allowCalendarSharing [allowCalendarSharing]',
56
+ autocomplete: ['true', 'false']
57
+ },
58
+ {
59
+ option: '--allowTenantMoveWithDataLoss [allowTenantMoveWithDataLoss]',
60
+ autocomplete: ['true', 'false']
61
+ },
62
+ {
63
+ option: '--allowTenantMoveWithDataMigration [allowTenantMoveWithDataMigration]',
64
+ autocomplete: ['true', 'false']
65
+ },
66
+ {
67
+ option: '--allowRosterCreation [allowRosterCreation]',
68
+ autocomplete: ['true', 'false']
69
+ },
70
+ {
71
+ option: '--allowPlannerMobilePushNotifications [allowPlannerMobilePushNotifications]',
72
+ autocomplete: ['true', 'false']
73
+ }
74
+ ];
75
+ const parentOptions = super.options();
76
+ return options.concat(parentOptions);
77
+ }
78
+ validate(args) {
79
+ const optionsArray = [
80
+ args.options.isPlannerAllowed, args.options.allowCalendarSharing, args.options.allowTenantMoveWithDataLoss,
81
+ args.options.allowTenantMoveWithDataMigration, args.options.allowRosterCreation, args.options.allowPlannerMobilePushNotifications
82
+ ];
83
+ if (optionsArray.every(o => typeof o === 'undefined')) {
84
+ return 'You must specify at least one option';
85
+ }
86
+ for (const option of optionsArray) {
87
+ if (typeof option !== 'undefined' && !utils_1.validation.isValidBoolean(option)) {
88
+ return `Value '${option}' is not a valid boolean`;
89
+ }
90
+ }
91
+ return true;
92
+ }
93
+ }
94
+ module.exports = new PlannerTenantSettingsSetCommand();
95
+ //# sourceMappingURL=tenant-settings-set.js.map
@@ -11,6 +11,7 @@ exports.default = {
11
11
  PLAN_DETAILS_GET: `${prefix} plan details get`,
12
12
  PLAN_GET: `${prefix} plan get`,
13
13
  PLAN_LIST: `${prefix} plan list`,
14
+ PLAN_REMOVE: `${prefix} plan remove`,
14
15
  TASK_ADD: `${prefix} task add`,
15
16
  TASK_CHECKLISTITEM_ADD: `${prefix} task checklistitem add`,
16
17
  TASK_CHECKLISTITEM_LIST: `${prefix} task checklistitem list`,
@@ -23,6 +24,7 @@ exports.default = {
23
24
  TASK_REFERENCE_REMOVE: `${prefix} task reference remove`,
24
25
  TASK_REMOVE: `${prefix} task remove`,
25
26
  TASK_SET: `${prefix} task set`,
26
- TENANT_SETTINGS_LIST: `${prefix} tenant settings list`
27
+ TENANT_SETTINGS_LIST: `${prefix} tenant settings list`,
28
+ TENANT_SETTINGS_SET: `${prefix} tenant settings set`
27
29
  };
28
30
  //# sourceMappingURL=commands.js.map
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const FN001008_DEP_react_1 = require("./rules/FN001008_DEP_react");
4
+ const FN001009_DEP_react_dom_1 = require("./rules/FN001009_DEP_react_dom");
5
+ const FN001022_DEP_office_ui_fabric_react_1 = require("./rules/FN001022_DEP_office_ui_fabric_react");
6
+ const FN002004_DEVDEP_gulp_1 = require("./rules/FN002004_DEVDEP_gulp");
7
+ const FN002007_DEVDEP_ajv_1 = require("./rules/FN002007_DEVDEP_ajv");
8
+ const FN002013_DEVDEP_types_webpack_env_1 = require("./rules/FN002013_DEVDEP_types_webpack_env");
9
+ const FN002015_DEVDEP_types_react_1 = require("./rules/FN002015_DEVDEP_types_react");
10
+ const FN002016_DEVDEP_types_react_dom_1 = require("./rules/FN002016_DEVDEP_types_react_dom");
11
+ const FN002019_DEVDEP_microsoft_rush_stack_compiler_1 = require("./rules/FN002019_DEVDEP_microsoft_rush_stack_compiler");
12
+ module.exports = [
13
+ new FN001008_DEP_react_1.FN001008_DEP_react('16'),
14
+ new FN001009_DEP_react_dom_1.FN001009_DEP_react_dom('16'),
15
+ new FN001022_DEP_office_ui_fabric_react_1.FN001022_DEP_office_ui_fabric_react('7.185.7'),
16
+ new FN002004_DEVDEP_gulp_1.FN002004_DEVDEP_gulp('4.0.2'),
17
+ new FN002007_DEVDEP_ajv_1.FN002007_DEVDEP_ajv('^6.12.5'),
18
+ new FN002013_DEVDEP_types_webpack_env_1.FN002013_DEVDEP_types_webpack_env('~1.15.2'),
19
+ new FN002015_DEVDEP_types_react_1.FN002015_DEVDEP_types_react('16'),
20
+ new FN002016_DEVDEP_types_react_dom_1.FN002016_DEVDEP_types_react_dom('16'),
21
+ new FN002019_DEVDEP_microsoft_rush_stack_compiler_1.FN002019_DEVDEP_microsoft_rush_stack_compiler(['4.5'])
22
+ ];
23
+ //# sourceMappingURL=doctor-1.15.0.js.map
@@ -43,7 +43,8 @@ class SpfxProjectDoctorCommand extends base_project_command_1.BaseProjectCommand
43
43
  '1.12.1',
44
44
  '1.13.0',
45
45
  '1.13.1',
46
- '1.14.0'
46
+ '1.14.0',
47
+ '1.15.0'
47
48
  ];
48
49
  }
49
50
  get name() {
@@ -383,6 +383,21 @@ class SpfxDoctorCommand extends AnonymousCommand_1.default {
383
383
  range: '^4',
384
384
  fix: 'npm i -g yo@4'
385
385
  }
386
+ },
387
+ '1.15.0': {
388
+ gulp: {
389
+ range: '^4',
390
+ fix: 'npm i -g gulp@4'
391
+ },
392
+ node: {
393
+ range: '^12.13 || ^14.15 || ^16.13',
394
+ fix: 'Install Node.js v12.13, v14.15, v16.13 or higher'
395
+ },
396
+ sp: SharePointVersion.SPO,
397
+ yo: {
398
+ range: '^4',
399
+ fix: 'npm i -g yo@4'
400
+ }
386
401
  }
387
402
  };
388
403
  }
@@ -281,11 +281,11 @@ class SpoListItemSetCommand extends SpoCommand_1.default {
281
281
  requestBody.push(`
282
282
  <Parameters>
283
283
  <Parameter Type="String">${key}</Parameter>
284
- <Parameter Type="String">${options[key]}</Parameter>
284
+ <Parameter Type="String">${options[key].toString()}</Parameter>
285
285
  </Parameters>`);
286
286
  }
287
287
  else {
288
- requestBody.push({ FieldName: key, FieldValue: options[key] });
288
+ requestBody.push({ FieldName: key, FieldValue: options[key].toString() });
289
289
  }
290
290
  }
291
291
  });
@@ -0,0 +1,155 @@
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 util = require("util");
13
+ const cli_1 = require("../../../../cli");
14
+ const GraphCommand_1 = require("../../../base/GraphCommand");
15
+ const commands_1 = require("../../commands");
16
+ class TeamsCacheRemoveCommand extends GraphCommand_1.default {
17
+ constructor() {
18
+ super(...arguments);
19
+ this.exec = util.promisify(require('child_process').exec);
20
+ }
21
+ get name() {
22
+ return commands_1.default.CACHE_REMOVE;
23
+ }
24
+ get description() {
25
+ return 'Removes the Microsoft Teams client cache';
26
+ }
27
+ getTelemetryProperties(args) {
28
+ const telemetryProps = super.getTelemetryProperties(args);
29
+ telemetryProps.confirm = (!(!args.options.confirm)).toString();
30
+ return telemetryProps;
31
+ }
32
+ commandAction(logger, args, cb) {
33
+ if (args.options.confirm) {
34
+ this.clearTeamsCache(logger, cb);
35
+ }
36
+ else {
37
+ logger.logToStderr('This command will execute the following steps.');
38
+ logger.logToStderr('- Stop the Microsoft Teams client.');
39
+ logger.logToStderr('- Clear the Microsoft Teams cached files.');
40
+ cli_1.Cli.prompt({
41
+ type: 'confirm',
42
+ name: 'continue',
43
+ default: false,
44
+ message: `Are you sure you want to clear your Microsoft Teams cache?`
45
+ }, (result) => {
46
+ if (!result.continue) {
47
+ cb();
48
+ }
49
+ else {
50
+ this.clearTeamsCache(logger, cb);
51
+ }
52
+ });
53
+ }
54
+ }
55
+ clearTeamsCache(logger, cb) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ try {
58
+ yield this.killRunningProcess(logger);
59
+ yield this.removeCacheFiles(logger);
60
+ }
61
+ catch (e) {
62
+ cb(e.message);
63
+ return;
64
+ }
65
+ logger.logToStderr('Teams cache cleared!');
66
+ cb();
67
+ });
68
+ }
69
+ killRunningProcess(logger) {
70
+ return __awaiter(this, void 0, void 0, function* () {
71
+ if (this.verbose) {
72
+ logger.logToStderr('Stop Teams client');
73
+ }
74
+ const platform = process.platform;
75
+ let cmd = '';
76
+ switch (platform) {
77
+ case 'win32':
78
+ cmd = 'taskkill /IM "Teams.exe" /F';
79
+ break;
80
+ case 'darwin':
81
+ cmd = `ps ax | grep MacOS/Teams -m 1 | grep -v grep | awk '{ print $1 }'`;
82
+ break;
83
+ }
84
+ if (this.debug) {
85
+ logger.logToStderr(cmd);
86
+ }
87
+ try {
88
+ const cmdOutput = yield this.exec(cmd);
89
+ if (cmdOutput.stdout !== '' && platform === 'darwin') {
90
+ process.kill(cmdOutput.stdout);
91
+ }
92
+ if (this.verbose) {
93
+ logger.logToStderr('Teams client closed');
94
+ }
95
+ }
96
+ catch (e) {
97
+ const errorMessage = e.message;
98
+ if (errorMessage.includes('ERROR: The process "Teams.exe" not found.')) {
99
+ if (this.verbose) {
100
+ logger.logToStderr('Teams client isn\'t running');
101
+ }
102
+ }
103
+ else {
104
+ throw new Error(errorMessage);
105
+ }
106
+ }
107
+ });
108
+ }
109
+ removeCacheFiles(logger) {
110
+ return __awaiter(this, void 0, void 0, function* () {
111
+ if (this.verbose) {
112
+ logger.logToStderr('Clear Teams cached files');
113
+ }
114
+ const platform = process.platform;
115
+ let cmd = '';
116
+ switch (platform) {
117
+ case 'win32':
118
+ cmd = 'cd %userprofile% && rmdir /s /q AppData\\Roaming\\Microsoft\\Teams';
119
+ break;
120
+ case 'darwin':
121
+ cmd = 'rm -r ~/Library/Application\\ Support/Microsoft/Teams';
122
+ break;
123
+ }
124
+ if (this.debug) {
125
+ logger.logToStderr(cmd);
126
+ }
127
+ try {
128
+ yield this.exec(cmd);
129
+ }
130
+ catch (e) {
131
+ throw new Error(e.message);
132
+ }
133
+ });
134
+ }
135
+ options() {
136
+ const options = [
137
+ {
138
+ option: '--confirm'
139
+ }
140
+ ];
141
+ const parentOptions = super.options();
142
+ return options.concat(parentOptions);
143
+ }
144
+ validate() {
145
+ if (process.env.CLIMICROSOFT365_ENV === 'docker') {
146
+ return 'Because you\'re running CLI for Microsoft 365 in a Docker container, we can\'t clear the cache on your host. Instead run this command on your host using "npx ..."';
147
+ }
148
+ if (process.platform !== 'win32' && process.platform !== 'darwin') {
149
+ return `${process.platform} platform is unsupported for this command`;
150
+ }
151
+ return true;
152
+ }
153
+ }
154
+ module.exports = new TeamsCacheRemoveCommand();
155
+ //# sourceMappingURL=cache-remove.js.map
@@ -8,6 +8,7 @@ exports.default = {
8
8
  APP_REMOVE: `${prefix} app remove`,
9
9
  APP_UNINSTALL: `${prefix} app uninstall`,
10
10
  APP_UPDATE: `${prefix} app update`,
11
+ CACHE_REMOVE: `${prefix} cache remove`,
11
12
  CHANNEL_ADD: `${prefix} channel add`,
12
13
  CHANNEL_GET: `${prefix} channel get`,
13
14
  CHANNEL_LIST: `${prefix} channel list`,
@@ -24,10 +24,11 @@ exports.planner = {
24
24
  /**
25
25
  * Get Planner plan by ID.
26
26
  * @param id Planner ID.
27
+ * @param metadata OData metadata level. Default is none
27
28
  */
28
- getPlanById(id) {
29
+ getPlanById(id, metadata = 'none') {
29
30
  return __awaiter(this, void 0, void 0, function* () {
30
- const requestOptions = getRequestOptions(`${graphResource}/v1.0/planner/plans/${id}`, 'none');
31
+ const requestOptions = getRequestOptions(`${graphResource}/v1.0/planner/plans/${id}`, metadata);
31
32
  try {
32
33
  return yield request_1.default.get(requestOptions);
33
34
  }
@@ -8,6 +8,12 @@ Retrieve information about the specified plan
8
8
  m365 planner plan get [options]
9
9
  ```
10
10
 
11
+ ## Alias
12
+
13
+ ```sh
14
+ m365 planner plan details get [options]
15
+ ```
16
+
11
17
  ## Options
12
18
 
13
19
  `-i, --id [id]`
@@ -16,11 +22,17 @@ m365 planner plan get [options]
16
22
  `-t, --title [title]`
17
23
  : Title of the plan. Specify either `id` or `title` but not both.
18
24
 
25
+ `--planId [planId]`
26
+ : (deprecated. Use `id` instead) ID of the plan. Specify either `planId` or `planTitle` but not both.
27
+
28
+ `---planTitle [planTitle]`
29
+ : (deprecated. Use `title` instead) Title of the plan. Specify either `planId` or `planTitle` but not both.
30
+
19
31
  `--ownerGroupId [ownerGroupId]`
20
- : ID of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `title`.
32
+ : ID of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `title` or the deprecated `planTitle`.
21
33
 
22
34
  `--ownerGroupName [ownerGroupName]`
23
- : Name of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `title`.
35
+ : Name of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `title` or the deprecated `planTitle`.
24
36
 
25
37
  --8<-- "docs/cmd/_global.md"
26
38
 
@@ -0,0 +1,48 @@
1
+ ## planner plan remove
2
+
3
+ Removes the Microsoft Planner plan
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 planner plan remove [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `i, --id [id]`
14
+ : ID of the plan to remove. Specify either `id` or `title` but not both.
15
+
16
+ `-t, --title [title]`
17
+ : Title of the plan to remove. Specify either `id` or `title` but not both.
18
+
19
+ `--ownerGroupId [ownerGroupId]`
20
+ : ID of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `title`.
21
+
22
+ `--ownerGroupName [ownerGroupName]`
23
+ : Name of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `title`.
24
+
25
+ `--confirm`
26
+ : Don't prompt for confirmation.
27
+
28
+ --8<-- "docs/cmd/_global.md"
29
+
30
+ ## Examples
31
+
32
+ Removes the Microsoft Planner plan by ID
33
+
34
+ ```sh
35
+ m365 planner plan remove --id gndWOTSK60GfPQfiDDj43JgACDCb
36
+ ```
37
+
38
+ Removes the Microsoft Planner plan with title _My Plan_ in group with specific ID
39
+
40
+ ```sh
41
+ m365 planner plan remove --title "My Plan" --ownerGroupId 00000000-0000-0000-0000-000000000000
42
+ ```
43
+
44
+ Removes the Microsoft Planner plan with title _My Plan_ in group with name _My Planner Group_ without confirmation prompt
45
+
46
+ ```sh
47
+ m365 planner plan remove --title "My Plan" --ownerGroupName "My Planner Group" --confirm
48
+ ```
@@ -0,0 +1,56 @@
1
+ # planner tenant settings set
2
+
3
+ Sets Microsoft Planner configuration of the tenant
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 planner tenant settings set [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `--isPlannerAllowed [isPlannerAllowed]`
14
+ : Configure whether Planner should be enabled on the tenant.
15
+
16
+ `--allowCalendarSharing [allowCalendarSharing]`
17
+ : Configure whether Outlook calendar sync is enabled.
18
+
19
+ `--allowTenantMoveWithDataLoss [allowTenantMoveWithDataLoss]`
20
+ : Configure whether a tenant move into a new region is authorized.
21
+
22
+ `--allowTenantMoveWithDataMigration [allowTenantMoveWithDataMigration]`
23
+ : Configure whether a tenant move with data migration is authorized.
24
+
25
+ `--allowRosterCreation [allowRosterCreation]`
26
+ : Configure whether Planner roster creation is allowed.
27
+
28
+ `--allowPlannerMobilePushNotifications [allowPlannerMobilePushNotifications]`
29
+ : Configure whether push notifications are enabled in the mobile app.
30
+
31
+ --8<-- "docs/cmd/_global.md"
32
+
33
+ ## Remarks
34
+
35
+ !!! important
36
+ To use this command you must be a global administrator.
37
+
38
+ ## Examples
39
+
40
+ Disable Microsoft Planner in the tenant
41
+
42
+ ```sh
43
+ m365 planner tenant settings set --isPlannerAllowed false
44
+ ```
45
+
46
+ Disable Outlook calendar sync and mobile push notifications
47
+
48
+ ```sh
49
+ m365 planner tenant settings set --allowCalendarSharing false --allowPlannerMobilePushNotifications false
50
+ ```
51
+
52
+ Enable Microsoft Planner but disallow roster plans to be created
53
+
54
+ ```sh
55
+ m365 planner tenant settings set --isPlannerAllowed true --allowRosterCreation false
56
+ ```
@@ -0,0 +1,46 @@
1
+ # teams cache remove
2
+
3
+ Removes the Microsoft Teams client cache
4
+
5
+ ## Usage
6
+
7
+ ```sh
8
+ m365 teams cache remove [options]
9
+ ```
10
+
11
+ ## Options
12
+
13
+ `--confirm`
14
+ : Don't prompt for confirmation
15
+
16
+ --8<-- "docs/cmd/_global.md"
17
+
18
+ ## Remarks
19
+
20
+ This command will execute the following steps.
21
+
22
+ - Stop the Microsoft Teams client. This will kill all the running `Teams.exe` tasks.
23
+
24
+ - Clear the Microsoft Teams cached files. For Windows it will delete all files and folders in the %appdata%\Microsoft\Teams directory. For macOS it will delete all files and folders in the ~/Library/Application Support/Microsoft/Teams directory.
25
+
26
+ !!! important
27
+ - You won't lose any user data by clearing the cache.
28
+ - Restarting Teams after you clear the cache might take longer than usual because the Teams cache files have to be rebuilt.
29
+
30
+ If you run the command in the CLI Docker container, you will get the following error message:
31
+
32
+ > Because you're running CLI for Microsoft 365 in a Docker container, we can't clear the cache on your host. Instead run this command on your host using 'npx ...'.
33
+
34
+ The command works only on Windows and macOS. If you run it on a different operating system, you will get the `'abc' platform is unsupported for this command` error.
35
+
36
+ ## Examples
37
+
38
+ Removes the Microsoft Teams client cache
39
+
40
+ ```sh
41
+ m365 teams cache remove
42
+ ```
43
+
44
+ ## More information
45
+
46
+ - [Clear the Teams client cache guidance](https://docs.microsoft.com/microsoftteams/troubleshoot/teams-administration/clear-teams-cache)
@@ -16,7 +16,7 @@ m365 tenant serviceannouncement health get [options]
16
16
  `-i, --issues`
17
17
  : Return the collection of issues that happened on the service, with detailed information for each issue. Is only returned in JSON output mode.
18
18
 
19
- --8<-- "docs/cmd/\_global.md"
19
+ --8<-- "docs/cmd/_global.md"
20
20
 
21
21
  ## Examples
22
22
 
@@ -13,7 +13,7 @@ m365 tenant serviceannouncement healthissue list [options]
13
13
  `-s, --service [service]`
14
14
  : Retrieve service health issues for the particular service. If not provided, retrieves health issues for all services
15
15
 
16
- --8<-- "docs/cmd/\_global.md"
16
+ --8<-- "docs/cmd/_global.md"
17
17
 
18
18
  ## Examples
19
19
 
@@ -13,7 +13,7 @@ m365 tenant serviceannouncement message list [options]
13
13
  `-s, --service [service]`
14
14
  : Retrieve service update messages for the particular service. If not provided, retrieves messages for all services
15
15
 
16
- --8<-- "docs/cmd/\_global.md"
16
+ --8<-- "docs/cmd/_global.md"
17
17
 
18
18
  ## Examples
19
19
 
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "5.4.0",
3
+ "version": "5.5.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@pnp/cli-microsoft365",
9
- "version": "5.4.0",
9
+ "version": "5.5.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@azure/msal-node": "^1.9.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pnp/cli-microsoft365",
3
- "version": "5.4.0",
3
+ "version": "5.5.0-beta.42585c2",
4
4
  "description": "Manage Microsoft 365 and SharePoint Framework projects on any platform",
5
5
  "license": "MIT",
6
6
  "main": "./dist/api.js",
@@ -51,7 +51,7 @@
51
51
  "name": "Waldek Mastykarz",
52
52
  "email": "waldek@mastykarz.nl",
53
53
  "web": "https://blog.mastykarz.nl"
54
- },
54
+ },
55
55
  {
56
56
  "name": "Garry Trinder",
57
57
  "email": "garry.trinder@live.com",
@@ -239,4 +239,4 @@
239
239
  "sinon": "^14.0.0",
240
240
  "source-map-support": "^0.5.21"
241
241
  }
242
- }
242
+ }
@@ -1,116 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const utils_1 = require("../../../../utils");
4
- const Auth_1 = require("../../../../Auth");
5
- const request_1 = require("../../../../request");
6
- const planner_1 = require("../../../../utils/planner");
7
- const GraphCommand_1 = require("../../../base/GraphCommand");
8
- const commands_1 = require("../../commands");
9
- const aadGroup_1 = require("../../../../utils/aadGroup");
10
- class PlannerPlanDetailsGetCommand extends GraphCommand_1.default {
11
- constructor() {
12
- super(...arguments);
13
- this.groupId = '';
14
- }
15
- get name() {
16
- return commands_1.default.PLAN_DETAILS_GET;
17
- }
18
- get description() {
19
- return 'Get details of a Microsoft Planner plan';
20
- }
21
- getTelemetryProperties(args) {
22
- const telemetryProps = super.getTelemetryProperties(args);
23
- telemetryProps.planId = typeof args.options.planId !== 'undefined';
24
- telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
25
- telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
26
- telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
27
- return telemetryProps;
28
- }
29
- commandAction(logger, args, cb) {
30
- if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
31
- this.handleError('This command does not support application permissions.', logger, cb);
32
- return;
33
- }
34
- this
35
- .getGroupId(args)
36
- .then((groupId) => {
37
- this.groupId = groupId;
38
- return this.getPlanId(args);
39
- })
40
- .then((planId) => {
41
- args.options.planId = planId;
42
- return this.getPlanDetails(args);
43
- })
44
- .then((res) => {
45
- logger.log(res);
46
- cb();
47
- }, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
48
- }
49
- getGroupId(args) {
50
- if (args.options.planId) {
51
- return Promise.resolve('');
52
- }
53
- if (args.options.ownerGroupId) {
54
- return Promise.resolve(args.options.ownerGroupId);
55
- }
56
- return aadGroup_1.aadGroup
57
- .getGroupByDisplayName(args.options.ownerGroupName)
58
- .then(group => group.id);
59
- }
60
- getPlanId(args) {
61
- if (args.options.planId) {
62
- return Promise.resolve(args.options.planId);
63
- }
64
- return planner_1.planner
65
- .getPlanByName(args.options.planTitle, this.groupId)
66
- .then(plan => plan.id);
67
- }
68
- getPlanDetails(args) {
69
- const requestOptions = {
70
- url: `${this.resource}/v1.0/planner/plans/${args.options.planId}/details`,
71
- headers: {
72
- 'accept': 'application/json;odata.metadata=none'
73
- },
74
- responseType: 'json'
75
- };
76
- return request_1.default.get(requestOptions);
77
- }
78
- options() {
79
- const options = [
80
- {
81
- option: '-i, --planId [planId]'
82
- },
83
- {
84
- option: '-t, --planTitle [planTitle]'
85
- },
86
- {
87
- option: '--ownerGroupId [ownerGroupId]'
88
- },
89
- {
90
- option: '--ownerGroupName [ownerGroupName]'
91
- }
92
- ];
93
- const parentOptions = super.options();
94
- return options.concat(parentOptions);
95
- }
96
- validate(args) {
97
- if (!args.options.planId && !args.options.planTitle) {
98
- return 'Specify either planId or planTitle';
99
- }
100
- if (args.options.planId && args.options.planTitle) {
101
- return 'Specify either planId or planTitle';
102
- }
103
- if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
104
- return 'Specify either ownerGroupId or ownerGroupName';
105
- }
106
- if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
107
- return 'Specify either ownerGroupId or ownerGroupName but not both';
108
- }
109
- if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
110
- return `${args.options.ownerGroupId} is not a valid GUID`;
111
- }
112
- return true;
113
- }
114
- }
115
- module.exports = new PlannerPlanDetailsGetCommand();
116
- //# sourceMappingURL=plan-details-get.js.map
@@ -1,45 +0,0 @@
1
- # planner plan details get
2
-
3
- Retrieve the planner details about the specified plan.
4
-
5
- ## Usage
6
-
7
- ```sh
8
- m365 planner plan details get [options]
9
- ```
10
-
11
- ## Options
12
-
13
- `-i, --planId [planId]`
14
- : ID of the plan. Specify either `planId` or `planTitle` but not both.
15
-
16
- `-t, --planTitle [planTitle]`
17
- : Title of the plan. Specify either `planId` or `planTitle` but not both.
18
-
19
- `--ownerGroupId [ownerGroupId]`
20
- : ID of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `planTitle`.
21
-
22
- `--ownerGroupName [ownerGroupName]`
23
- : Name of the Group that owns the plan. Specify either `ownerGroupId` or `ownerGroupName` when using `planTitle`.
24
-
25
- --8<-- "docs/cmd/_global.md"
26
-
27
- ## Examples
28
-
29
- Returns the Microsoft Planner plan details with id _gndWOTSK60GfPQfiDDj43JgACDCb_
30
-
31
- ```sh
32
- m365 planner plan details get --planId "gndWOTSK60GfPQfiDDj43JgACDCb"
33
- ```
34
-
35
- Returns the Microsoft Planner plan details with title _MyPlan_ for Group _233e43d0-dc6a-482e-9b4e-0de7a7bce9b4_
36
-
37
- ```sh
38
- m365 planner plan details get --planTitle "MyPlan" --ownerGroupId "233e43d0-dc6a-482e-9b4e-0de7a7bce9b4"
39
- ```
40
-
41
- Returns the Microsoft Planner plan details with title _MyPlan_ for Group _My Planner Group_
42
-
43
- ```sh
44
- m365 planner plan details get --planTitle "MyPlan" --ownerGroupName "My Planner Group"
45
- ```