@pnp/cli-microsoft365 7.8.0-beta.5f64790 → 7.8.0-beta.a83837a
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/allCommands.json +1 -1
- package/allCommandsFull.json +1 -1
- package/dist/cli/cli.js +3 -6
- package/dist/m365/entra/commands/app/app-permission-add.js +25 -6
- package/dist/m365/entra/commands/app/app-permission-list.js +17 -5
- package/dist/m365/entra/commands/group/group-add.js +12 -14
- package/dist/m365/entra/commands/group/group-user-add.js +6 -7
- package/dist/m365/entra/commands/user/user-registrationdetails-list.js +6 -7
- package/dist/m365/planner/commands/bucket/bucket-add.js +4 -7
- package/dist/m365/planner/commands/bucket/bucket-get.js +7 -30
- package/dist/m365/planner/commands/bucket/bucket-list.js +3 -6
- package/dist/m365/planner/commands/bucket/bucket-remove.js +8 -25
- package/dist/m365/planner/commands/bucket/bucket-set.js +12 -34
- package/dist/m365/planner/commands/plan/plan-add.js +17 -7
- package/dist/m365/planner/commands/plan/plan-get.js +12 -22
- package/dist/m365/planner/commands/plan/plan-list.js +1 -2
- package/dist/m365/planner/commands/plan/plan-remove.js +5 -3
- package/dist/m365/planner/commands/plan/plan-set.js +18 -10
- package/dist/m365/planner/commands/roster/roster-add.js +1 -2
- package/dist/m365/planner/commands/task/task-add.js +15 -21
- package/dist/m365/planner/commands/task/task-checklistitem-add.js +1 -1
- package/dist/m365/planner/commands/task/task-checklistitem-remove.js +1 -1
- package/dist/m365/planner/commands/task/task-get.js +5 -26
- package/dist/m365/planner/commands/task/task-list.js +11 -37
- package/dist/m365/planner/commands/task/task-reference-remove.js +1 -1
- package/dist/m365/planner/commands/task/task-remove.js +12 -29
- package/dist/m365/planner/commands/task/task-set.js +15 -21
- package/dist/m365/spo/commands/listitem/listitem-batch-remove.js +222 -0
- package/dist/m365/spo/commands/navigation/navigation-node-add.js +3 -2
- package/dist/m365/spo/commands/navigation/navigation-node-set.js +3 -2
- package/dist/m365/spo/commands/site/site-recyclebinitem-move.js +5 -2
- package/dist/m365/spo/commands/site/site-recyclebinitem-remove.js +3 -2
- package/dist/m365/spo/commands/spo-set.js +6 -2
- package/dist/m365/spo/commands.js +1 -0
- package/dist/m365/teams/commands/meeting/meeting-add.js +3 -3
- package/dist/m365/teams/commands/team/team-add.js +22 -16
- package/dist/utils/planner.js +87 -8
- package/dist/utils/validation.js +8 -5
- package/docs/docs/cmd/entra/app/app-permission-add.mdx +7 -4
- package/docs/docs/cmd/entra/app/app-permission-list.mdx +14 -5
- package/docs/docs/cmd/spo/listitem/listitem-batch-remove.mdx +70 -0
- package/package.json +1 -1
|
@@ -31,28 +31,19 @@ class PlannerPlanGetCommand extends GraphCommand {
|
|
|
31
31
|
}
|
|
32
32
|
async commandAction(logger, args) {
|
|
33
33
|
try {
|
|
34
|
+
let plan;
|
|
34
35
|
if (args.options.id) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
plan = await planner.getPlanById(args.options.id);
|
|
37
|
+
}
|
|
38
|
+
else if (args.options.rosterId) {
|
|
39
|
+
plan = await planner.getPlanByRosterId(args.options.rosterId);
|
|
38
40
|
}
|
|
39
41
|
else {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
plan = await planner.getPlanByRosterId(args.options.rosterId);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
let groupId = undefined;
|
|
46
|
-
if (args.options.ownerGroupId || args.options.ownerGroupName) {
|
|
47
|
-
groupId = await this.getGroupId(args);
|
|
48
|
-
}
|
|
49
|
-
plan = await planner.getPlanByTitle(args.options.title, groupId);
|
|
50
|
-
}
|
|
51
|
-
const result = await this.getPlanDetails(plan);
|
|
52
|
-
if (result) {
|
|
53
|
-
await logger.log(result);
|
|
54
|
-
}
|
|
42
|
+
const groupId = await this.getGroupId(args);
|
|
43
|
+
plan = await planner.getPlanByTitle(args.options.title, groupId);
|
|
55
44
|
}
|
|
45
|
+
const result = await this.getPlanDetails(plan);
|
|
46
|
+
await logger.log(result);
|
|
56
47
|
}
|
|
57
48
|
catch (err) {
|
|
58
49
|
this.handleRejectedODataJsonPromise(err);
|
|
@@ -62,8 +53,8 @@ class PlannerPlanGetCommand extends GraphCommand {
|
|
|
62
53
|
const requestOptionsTaskDetails = {
|
|
63
54
|
url: `${this.resource}/v1.0/planner/plans/${plan.id}/details`,
|
|
64
55
|
headers: {
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
accept: 'application/json;odata.metadata=none',
|
|
57
|
+
Prefer: 'return=representation'
|
|
67
58
|
},
|
|
68
59
|
responseType: 'json'
|
|
69
60
|
};
|
|
@@ -74,8 +65,7 @@ class PlannerPlanGetCommand extends GraphCommand {
|
|
|
74
65
|
if (args.options.ownerGroupId) {
|
|
75
66
|
return args.options.ownerGroupId;
|
|
76
67
|
}
|
|
77
|
-
|
|
78
|
-
return group.id;
|
|
68
|
+
return entraGroup.getGroupIdByDisplayName(args.options.ownerGroupName);
|
|
79
69
|
}
|
|
80
70
|
}
|
|
81
71
|
_PlannerPlanGetCommand_instances = new WeakSet(), _PlannerPlanGetCommand_initTelemetry = function _PlannerPlanGetCommand_initTelemetry() {
|
|
@@ -49,8 +49,7 @@ class PlannerPlanListCommand extends GraphCommand {
|
|
|
49
49
|
if (args.options.ownerGroupId) {
|
|
50
50
|
return args.options.ownerGroupId;
|
|
51
51
|
}
|
|
52
|
-
|
|
53
|
-
return group.id;
|
|
52
|
+
return entraGroup.getGroupIdByDisplayName(args.options.ownerGroupName);
|
|
54
53
|
}
|
|
55
54
|
}
|
|
56
55
|
_PlannerPlanListCommand_instances = new WeakSet(), _PlannerPlanListCommand_initTelemetry = function _PlannerPlanListCommand_initTelemetry() {
|
|
@@ -31,6 +31,9 @@ class PlannerPlanRemoveCommand extends GraphCommand {
|
|
|
31
31
|
const removePlan = async () => {
|
|
32
32
|
try {
|
|
33
33
|
const plan = await this.getPlan(args);
|
|
34
|
+
if (this.verbose) {
|
|
35
|
+
await logger.logToStderr(`Removing plan '${plan.title}' ...`);
|
|
36
|
+
}
|
|
34
37
|
const requestOptions = {
|
|
35
38
|
url: `${this.resource}/v1.0/planner/plans/${plan.id}`,
|
|
36
39
|
headers: {
|
|
@@ -61,15 +64,14 @@ class PlannerPlanRemoveCommand extends GraphCommand {
|
|
|
61
64
|
return planner.getPlanById(id, 'minimal');
|
|
62
65
|
}
|
|
63
66
|
const groupId = await this.getGroupId(args);
|
|
64
|
-
return
|
|
67
|
+
return planner.getPlanByTitle(title, groupId, 'minimal');
|
|
65
68
|
}
|
|
66
69
|
async getGroupId(args) {
|
|
67
70
|
const { ownerGroupId, ownerGroupName } = args.options;
|
|
68
71
|
if (ownerGroupId) {
|
|
69
72
|
return ownerGroupId;
|
|
70
73
|
}
|
|
71
|
-
|
|
72
|
-
return group.id;
|
|
74
|
+
return entraGroup.getGroupIdByDisplayName(ownerGroupName);
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
_PlannerPlanRemoveCommand_instances = new WeakSet(), _PlannerPlanRemoveCommand_initTelemetry = function _PlannerPlanRemoveCommand_initTelemetry() {
|
|
@@ -38,23 +38,22 @@ class PlannerPlanSetCommand extends GraphCommand {
|
|
|
38
38
|
if (ownerGroupId) {
|
|
39
39
|
return ownerGroupId;
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
return
|
|
41
|
+
const id = await entraGroup.getGroupIdByDisplayName(ownerGroupName);
|
|
42
|
+
return id;
|
|
43
43
|
}
|
|
44
44
|
async getPlanId(args) {
|
|
45
45
|
const { id, title } = args.options;
|
|
46
46
|
if (id) {
|
|
47
47
|
return id;
|
|
48
48
|
}
|
|
49
|
-
let groupId = '';
|
|
50
49
|
if (args.options.rosterId) {
|
|
51
|
-
const
|
|
52
|
-
return
|
|
50
|
+
const id = await planner.getPlanIdByRosterId(args.options.rosterId);
|
|
51
|
+
return id;
|
|
53
52
|
}
|
|
54
53
|
else {
|
|
55
|
-
groupId = await this.getGroupId(args);
|
|
56
|
-
const
|
|
57
|
-
return
|
|
54
|
+
const groupId = await this.getGroupId(args);
|
|
55
|
+
const id = await planner.getPlanIdByTitle(title, groupId);
|
|
56
|
+
return id;
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
async getUserIds(options) {
|
|
@@ -226,8 +225,17 @@ _PlannerPlanSetCommand_instances = new WeakSet(), _PlannerPlanSetCommand_initTel
|
|
|
226
225
|
if (args.options.shareWithUserIds && args.options.shareWithUserNames) {
|
|
227
226
|
return 'Specify either shareWithUserIds or shareWithUserNames but not both';
|
|
228
227
|
}
|
|
229
|
-
if (args.options.shareWithUserIds
|
|
230
|
-
|
|
228
|
+
if (args.options.shareWithUserIds) {
|
|
229
|
+
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.shareWithUserIds);
|
|
230
|
+
if (isValidGUIDArrayResult !== true) {
|
|
231
|
+
return `The following GUIDs are invalid for the option 'shareWithUserIds': ${isValidGUIDArrayResult}.`;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (args.options.shareWithUserNames) {
|
|
235
|
+
const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.shareWithUserNames);
|
|
236
|
+
if (isValidUPNArrayResult !== true) {
|
|
237
|
+
return `The following user principal names are invalid for the option 'shareWithUserNames': ${isValidUPNArrayResult}.`;
|
|
238
|
+
}
|
|
231
239
|
}
|
|
232
240
|
const allowedCategories = [
|
|
233
241
|
'category1',
|
|
@@ -13,13 +13,12 @@ class PlannerRosterAddCommand extends GraphCommand {
|
|
|
13
13
|
await logger.logToStderr('Creating a new Microsoft Planner Roster');
|
|
14
14
|
}
|
|
15
15
|
try {
|
|
16
|
-
const requestBody = {};
|
|
17
16
|
const requestOptions = {
|
|
18
17
|
url: `${this.resource}/beta/planner/rosters`,
|
|
19
18
|
headers: {
|
|
20
19
|
accept: 'application/json;odata.metadata=none'
|
|
21
20
|
},
|
|
22
|
-
data:
|
|
21
|
+
data: {},
|
|
23
22
|
responseType: 'json'
|
|
24
23
|
};
|
|
25
24
|
const response = await request.post(requestOptions);
|
|
@@ -124,40 +124,25 @@ class PlannerTaskAddCommand extends GraphCommand {
|
|
|
124
124
|
if (args.options.bucketId) {
|
|
125
125
|
return args.options.bucketId;
|
|
126
126
|
}
|
|
127
|
-
|
|
128
|
-
url: `${this.resource}/v1.0/planner/plans/${planId}/buckets`,
|
|
129
|
-
headers: {
|
|
130
|
-
accept: 'application/json;odata.metadata=none'
|
|
131
|
-
},
|
|
132
|
-
responseType: 'json'
|
|
133
|
-
};
|
|
134
|
-
const response = await request.get(requestOptions);
|
|
135
|
-
const bucket = response.value.find(val => val.name === args.options.bucketName);
|
|
136
|
-
if (!bucket) {
|
|
137
|
-
throw `The specified bucket does not exist`;
|
|
138
|
-
}
|
|
139
|
-
return bucket.id;
|
|
127
|
+
return planner.getBucketIdByTitle(args.options.bucketName, planId);
|
|
140
128
|
}
|
|
141
129
|
async getPlanId(args) {
|
|
142
130
|
if (args.options.planId) {
|
|
143
131
|
return args.options.planId;
|
|
144
132
|
}
|
|
145
133
|
if (args.options.rosterId) {
|
|
146
|
-
|
|
147
|
-
return plan.id;
|
|
134
|
+
return planner.getPlanIdByRosterId(args.options.rosterId);
|
|
148
135
|
}
|
|
149
136
|
else {
|
|
150
137
|
const groupId = await this.getGroupId(args);
|
|
151
|
-
|
|
152
|
-
return plan.id;
|
|
138
|
+
return planner.getPlanIdByTitle(args.options.planTitle, groupId);
|
|
153
139
|
}
|
|
154
140
|
}
|
|
155
141
|
async getGroupId(args) {
|
|
156
142
|
if (args.options.ownerGroupId) {
|
|
157
143
|
return args.options.ownerGroupId;
|
|
158
144
|
}
|
|
159
|
-
|
|
160
|
-
return group.id;
|
|
145
|
+
return entraGroup.getGroupIdByDisplayName(args.options.ownerGroupName);
|
|
161
146
|
}
|
|
162
147
|
async getUserIds(options) {
|
|
163
148
|
if (options.assignedToUserIds) {
|
|
@@ -237,12 +222,21 @@ _PlannerTaskAddCommand_instances = new WeakSet(), _PlannerTaskAddCommand_initTel
|
|
|
237
222
|
if (args.options.percentComplete && (args.options.percentComplete < 0 || args.options.percentComplete > 100)) {
|
|
238
223
|
return `percentComplete should be between 0 and 100`;
|
|
239
224
|
}
|
|
240
|
-
if (args.options.assignedToUserIds
|
|
241
|
-
|
|
225
|
+
if (args.options.assignedToUserIds) {
|
|
226
|
+
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.assignedToUserIds);
|
|
227
|
+
if (isValidGUIDArrayResult !== true) {
|
|
228
|
+
return `The following GUIDs are invalid for the option 'assignedToUserIds': ${isValidGUIDArrayResult}.`;
|
|
229
|
+
}
|
|
242
230
|
}
|
|
243
231
|
if (args.options.assignedToUserIds && args.options.assignedToUserNames) {
|
|
244
232
|
return 'Specify either assignedToUserIds or assignedToUserNames but not both';
|
|
245
233
|
}
|
|
234
|
+
if (args.options.assignedToUserNames) {
|
|
235
|
+
const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.assignedToUserNames);
|
|
236
|
+
if (isValidUPNArrayResult !== true) {
|
|
237
|
+
return `The following user principal names are invalid for the option 'assignedToUserNames': ${isValidUPNArrayResult}.`;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
246
240
|
if (args.options.appliedCategories && args.options.appliedCategories.split(',').filter(category => this.allowedAppliedCategories.indexOf(category.toLocaleLowerCase()) < 0).length !== 0) {
|
|
247
241
|
return `The appliedCategories contains invalid value. Specify either ${this.allowedAppliedCategories.join(', ')} as properties`;
|
|
248
242
|
}
|
|
@@ -79,7 +79,7 @@ class PlannerTaskChecklistItemAddCommand extends GraphCommand {
|
|
|
79
79
|
_PlannerTaskChecklistItemAddCommand_instances = new WeakSet(), _PlannerTaskChecklistItemAddCommand_initTelemetry = function _PlannerTaskChecklistItemAddCommand_initTelemetry() {
|
|
80
80
|
this.telemetry.push((args) => {
|
|
81
81
|
Object.assign(this.telemetryProperties, {
|
|
82
|
-
isChecked: args.options.isChecked
|
|
82
|
+
isChecked: !!args.options.isChecked
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
}, _PlannerTaskChecklistItemAddCommand_initOptions = function _PlannerTaskChecklistItemAddCommand_initOptions() {
|
|
@@ -74,7 +74,7 @@ class PlannerTaskChecklistItemRemoveCommand extends GraphCommand {
|
|
|
74
74
|
_PlannerTaskChecklistItemRemoveCommand_instances = new WeakSet(), _PlannerTaskChecklistItemRemoveCommand_initTelemetry = function _PlannerTaskChecklistItemRemoveCommand_initTelemetry() {
|
|
75
75
|
this.telemetry.push((args) => {
|
|
76
76
|
Object.assign(this.telemetryProperties, {
|
|
77
|
-
force:
|
|
77
|
+
force: !!args.options.force
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
}, _PlannerTaskChecklistItemRemoveCommand_initOptions = function _PlannerTaskChecklistItemRemoveCommand_initOptions() {
|
|
@@ -81,7 +81,7 @@ class PlannerTaskGetCommand extends GraphCommand {
|
|
|
81
81
|
}
|
|
82
82
|
if (tasks.length > 1) {
|
|
83
83
|
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', tasks);
|
|
84
|
-
const result =
|
|
84
|
+
const result = await cli.handleMultipleResultsFound(`Multiple tasks with title '${options.title}' found.`, resultAsKeyValuePair);
|
|
85
85
|
return result.id;
|
|
86
86
|
}
|
|
87
87
|
return tasks[0].id;
|
|
@@ -91,46 +91,25 @@ class PlannerTaskGetCommand extends GraphCommand {
|
|
|
91
91
|
return options.bucketId;
|
|
92
92
|
}
|
|
93
93
|
const planId = await this.getPlanId(options);
|
|
94
|
-
|
|
95
|
-
url: `${this.resource}/v1.0/planner/plans/${planId}/buckets?$select=id,name`,
|
|
96
|
-
headers: {
|
|
97
|
-
accept: 'application/json;odata.metadata=none'
|
|
98
|
-
},
|
|
99
|
-
responseType: 'json'
|
|
100
|
-
};
|
|
101
|
-
const response = await request.get(requestOptions);
|
|
102
|
-
const bucketName = options.bucketName;
|
|
103
|
-
const buckets = response.value.filter(val => val.name?.toLocaleLowerCase() === bucketName.toLocaleLowerCase());
|
|
104
|
-
if (!buckets.length) {
|
|
105
|
-
throw `The specified bucket ${options.bucketName} does not exist`;
|
|
106
|
-
}
|
|
107
|
-
if (buckets.length > 1) {
|
|
108
|
-
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', buckets);
|
|
109
|
-
const result = await cli.handleMultipleResultsFound(`Multiple buckets with name '${options.bucketName}' found.`, resultAsKeyValuePair);
|
|
110
|
-
return result.id;
|
|
111
|
-
}
|
|
112
|
-
return buckets[0].id;
|
|
94
|
+
return planner.getBucketIdByTitle(options.bucketName, planId);
|
|
113
95
|
}
|
|
114
96
|
async getPlanId(options) {
|
|
115
97
|
if (options.planId) {
|
|
116
98
|
return options.planId;
|
|
117
99
|
}
|
|
118
100
|
if (options.rosterId) {
|
|
119
|
-
|
|
120
|
-
return plan.id;
|
|
101
|
+
return planner.getPlanIdByRosterId(options.rosterId);
|
|
121
102
|
}
|
|
122
103
|
else {
|
|
123
104
|
const groupId = await this.getGroupId(options);
|
|
124
|
-
|
|
125
|
-
return plan.id;
|
|
105
|
+
return planner.getPlanIdByTitle(options.planTitle, groupId);
|
|
126
106
|
}
|
|
127
107
|
}
|
|
128
108
|
async getGroupId(options) {
|
|
129
109
|
if (options.ownerGroupId) {
|
|
130
110
|
return options.ownerGroupId;
|
|
131
111
|
}
|
|
132
|
-
|
|
133
|
-
return group.id;
|
|
112
|
+
return entraGroup.getGroupIdByDisplayName(options.ownerGroupName);
|
|
134
113
|
}
|
|
135
114
|
}
|
|
136
115
|
_PlannerTaskGetCommand_instances = new WeakSet(), _PlannerTaskGetCommand_initTelemetry = function _PlannerTaskGetCommand_initTelemetry() {
|
|
@@ -4,7 +4,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
4
4
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
5
|
};
|
|
6
6
|
var _PlannerTaskListCommand_instances, _PlannerTaskListCommand_initTelemetry, _PlannerTaskListCommand_initOptions, _PlannerTaskListCommand_initValidators, _PlannerTaskListCommand_initOptionSets, _PlannerTaskListCommand_initTypes;
|
|
7
|
-
import request from '../../../../request.js';
|
|
8
7
|
import { entraGroup } from '../../../../utils/entraGroup.js';
|
|
9
8
|
import { formatting } from '../../../../utils/formatting.js';
|
|
10
9
|
import { odata } from '../../../../utils/odata.js';
|
|
@@ -37,37 +36,27 @@ class PlannerTaskListCommand extends GraphCommand {
|
|
|
37
36
|
const planTitle = args.options.planTitle;
|
|
38
37
|
let planId = args.options.planId;
|
|
39
38
|
let taskItems = [];
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
try {
|
|
40
|
+
if (bucketId || bucketName) {
|
|
42
41
|
bucketId = await this.getBucketId(args);
|
|
43
42
|
taskItems = await odata.getAllItems(`${this.resource}/v1.0/planner/buckets/${bucketId}/tasks`);
|
|
44
43
|
const betaTasks = await odata.getAllItems(`${this.resource}/beta/planner/buckets/${bucketId}/tasks`);
|
|
45
44
|
await logger.log(this.mergeTaskPriority(taskItems, betaTasks));
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
this.handleRejectedODataJsonPromise(err);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else if (planId || planTitle) {
|
|
52
|
-
try {
|
|
46
|
+
else if (planId || planTitle) {
|
|
53
47
|
planId = await this.getPlanId(args);
|
|
54
48
|
taskItems = await odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/tasks`);
|
|
55
49
|
const betaTasks = await odata.getAllItems(`${this.resource}/beta/planner/plans/${planId}/tasks`);
|
|
56
50
|
await logger.log(this.mergeTaskPriority(taskItems, betaTasks));
|
|
57
51
|
}
|
|
58
|
-
|
|
59
|
-
this.handleRejectedODataJsonPromise(err);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
try {
|
|
52
|
+
else {
|
|
64
53
|
taskItems = await odata.getAllItems(`${this.resource}/v1.0/me/planner/tasks`);
|
|
65
54
|
const betaTasks = await odata.getAllItems(`${this.resource}/beta/me/planner/tasks`);
|
|
66
55
|
await logger.log(this.mergeTaskPriority(taskItems, betaTasks));
|
|
67
56
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
this.handleRejectedODataJsonPromise(err);
|
|
71
60
|
}
|
|
72
61
|
}
|
|
73
62
|
async getBucketId(args) {
|
|
@@ -75,40 +64,25 @@ class PlannerTaskListCommand extends GraphCommand {
|
|
|
75
64
|
return formatting.encodeQueryParameter(args.options.bucketId);
|
|
76
65
|
}
|
|
77
66
|
const planId = await this.getPlanId(args);
|
|
78
|
-
|
|
79
|
-
url: `${this.resource}/v1.0/planner/plans/${planId}/buckets`,
|
|
80
|
-
headers: {
|
|
81
|
-
accept: 'application/json;odata.metadata=none'
|
|
82
|
-
},
|
|
83
|
-
responseType: 'json'
|
|
84
|
-
};
|
|
85
|
-
const response = await request.get(requestOptions);
|
|
86
|
-
const bucket = response.value.find(val => val.name === args.options.bucketName);
|
|
87
|
-
if (!bucket) {
|
|
88
|
-
throw `The specified bucket does not exist`;
|
|
89
|
-
}
|
|
90
|
-
return bucket.id;
|
|
67
|
+
return planner.getBucketIdByTitle(args.options.bucketName, planId);
|
|
91
68
|
}
|
|
92
69
|
async getPlanId(args) {
|
|
93
70
|
if (args.options.planId) {
|
|
94
71
|
return formatting.encodeQueryParameter(args.options.planId);
|
|
95
72
|
}
|
|
96
73
|
if (args.options.rosterId) {
|
|
97
|
-
|
|
98
|
-
return plan.id;
|
|
74
|
+
return planner.getPlanIdByRosterId(args.options.rosterId);
|
|
99
75
|
}
|
|
100
76
|
else {
|
|
101
77
|
const groupId = await this.getGroupId(args);
|
|
102
|
-
|
|
103
|
-
return plan.id;
|
|
78
|
+
return planner.getPlanIdByTitle(args.options.planTitle, groupId);
|
|
104
79
|
}
|
|
105
80
|
}
|
|
106
81
|
async getGroupId(args) {
|
|
107
82
|
if (args.options.ownerGroupId) {
|
|
108
83
|
return formatting.encodeQueryParameter(args.options.ownerGroupId);
|
|
109
84
|
}
|
|
110
|
-
|
|
111
|
-
return group.id;
|
|
85
|
+
return entraGroup.getGroupIdByDisplayName(args.options.ownerGroupName);
|
|
112
86
|
}
|
|
113
87
|
mergeTaskPriority(taskItems, betaTaskItems) {
|
|
114
88
|
const findBetaTask = (id) => betaTaskItems.find(task => task.id === id);
|
|
@@ -94,7 +94,7 @@ _PlannerTaskReferenceRemoveCommand_instances = new WeakSet(), _PlannerTaskRefere
|
|
|
94
94
|
Object.assign(this.telemetryProperties, {
|
|
95
95
|
url: typeof args.options.url !== 'undefined',
|
|
96
96
|
alias: typeof args.options.alias !== 'undefined',
|
|
97
|
-
force:
|
|
97
|
+
force: !!args.options.force
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
100
|
}, _PlannerTaskReferenceRemoveCommand_initOptions = function _PlannerTaskReferenceRemoveCommand_initOptions() {
|
|
@@ -33,6 +33,9 @@ class PlannerTaskRemoveCommand extends GraphCommand {
|
|
|
33
33
|
const removeTask = async () => {
|
|
34
34
|
try {
|
|
35
35
|
const task = await this.getTask(args.options);
|
|
36
|
+
if (this.verbose) {
|
|
37
|
+
await logger.logToStderr(`Removing task '${task.title}' ...`);
|
|
38
|
+
}
|
|
36
39
|
const requestOptions = {
|
|
37
40
|
url: `${this.resource}/v1.0/planner/tasks/${task.id}`,
|
|
38
41
|
headers: {
|
|
@@ -72,15 +75,15 @@ class PlannerTaskRemoveCommand extends GraphCommand {
|
|
|
72
75
|
const bucketId = await this.getBucketId(options);
|
|
73
76
|
// $filter is not working on the buckets/{bucketId}/tasks endpoint, hence it is not being used.
|
|
74
77
|
const tasks = await odata.getAllItems(`${this.resource}/v1.0/planner/buckets/${bucketId}/tasks?$select=title,id`, 'minimal');
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
78
|
+
const filteredTasks = tasks.filter(b => title.toLocaleLowerCase() === b.title.toLocaleLowerCase());
|
|
79
|
+
if (filteredTasks.length === 0) {
|
|
77
80
|
throw `The specified task ${title} does not exist`;
|
|
78
81
|
}
|
|
79
|
-
if (
|
|
80
|
-
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id',
|
|
82
|
+
if (filteredTasks.length > 1) {
|
|
83
|
+
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', filteredTasks);
|
|
81
84
|
return await cli.handleMultipleResultsFound(`Multiple tasks with title '${title}' found.`, resultAsKeyValuePair);
|
|
82
85
|
}
|
|
83
|
-
return
|
|
86
|
+
return filteredTasks[0];
|
|
84
87
|
}
|
|
85
88
|
async getBucketId(options) {
|
|
86
89
|
const { bucketId, bucketName } = options;
|
|
@@ -88,24 +91,7 @@ class PlannerTaskRemoveCommand extends GraphCommand {
|
|
|
88
91
|
return bucketId;
|
|
89
92
|
}
|
|
90
93
|
const planId = await this.getPlanId(options);
|
|
91
|
-
|
|
92
|
-
url: `${this.resource}/v1.0/planner/plans/${planId}/buckets?$select=id,name`,
|
|
93
|
-
headers: {
|
|
94
|
-
accept: 'application/json;odata.metadata=none'
|
|
95
|
-
},
|
|
96
|
-
responseType: 'json'
|
|
97
|
-
};
|
|
98
|
-
const buckets = await request.get(requestOptions);
|
|
99
|
-
const filteredBuckets = buckets.value.filter(b => bucketName.toLocaleLowerCase() === b.name.toLocaleLowerCase());
|
|
100
|
-
if (filteredBuckets.length === 0) {
|
|
101
|
-
throw `The specified bucket ${bucketName} does not exist`;
|
|
102
|
-
}
|
|
103
|
-
if (filteredBuckets.length > 1) {
|
|
104
|
-
const resultAsKeyValuePair = formatting.convertArrayToHashTable('id', filteredBuckets);
|
|
105
|
-
const result = await cli.handleMultipleResultsFound(`Multiple buckets with name '${bucketName}' found.`, resultAsKeyValuePair);
|
|
106
|
-
return result.id;
|
|
107
|
-
}
|
|
108
|
-
return filteredBuckets[0].id;
|
|
94
|
+
return planner.getBucketIdByTitle(bucketName, planId);
|
|
109
95
|
}
|
|
110
96
|
async getPlanId(options) {
|
|
111
97
|
const { planId, planTitle, rosterId } = options;
|
|
@@ -113,13 +99,11 @@ class PlannerTaskRemoveCommand extends GraphCommand {
|
|
|
113
99
|
return planId;
|
|
114
100
|
}
|
|
115
101
|
if (options.rosterId) {
|
|
116
|
-
|
|
117
|
-
return plan.id;
|
|
102
|
+
return planner.getPlanIdByRosterId(rosterId);
|
|
118
103
|
}
|
|
119
104
|
else {
|
|
120
105
|
const groupId = await this.getGroupId(options);
|
|
121
|
-
|
|
122
|
-
return plan.id;
|
|
106
|
+
return planner.getPlanIdByTitle(planTitle, groupId);
|
|
123
107
|
}
|
|
124
108
|
}
|
|
125
109
|
async getGroupId(options) {
|
|
@@ -127,8 +111,7 @@ class PlannerTaskRemoveCommand extends GraphCommand {
|
|
|
127
111
|
if (ownerGroupId) {
|
|
128
112
|
return ownerGroupId;
|
|
129
113
|
}
|
|
130
|
-
|
|
131
|
-
return group.id;
|
|
114
|
+
return entraGroup.getGroupIdByDisplayName(ownerGroupName);
|
|
132
115
|
}
|
|
133
116
|
}
|
|
134
117
|
_PlannerTaskRemoveCommand_instances = new WeakSet(), _PlannerTaskRemoveCommand_initTelemetry = function _PlannerTaskRemoveCommand_initTelemetry() {
|
|
@@ -154,40 +154,25 @@ class PlannerTaskSetCommand extends GraphCommand {
|
|
|
154
154
|
return undefined;
|
|
155
155
|
}
|
|
156
156
|
const planId = await this.getPlanId(options);
|
|
157
|
-
|
|
158
|
-
url: `${this.resource}/v1.0/planner/plans/${planId}/buckets?$select=id,name`,
|
|
159
|
-
headers: {
|
|
160
|
-
accept: 'application/json;odata.metadata=none'
|
|
161
|
-
},
|
|
162
|
-
responseType: 'json'
|
|
163
|
-
};
|
|
164
|
-
const response = await request.get(requestOptions);
|
|
165
|
-
const bucket = response.value.find(val => val.name === options.bucketName);
|
|
166
|
-
if (!bucket) {
|
|
167
|
-
throw 'The specified bucket does not exist';
|
|
168
|
-
}
|
|
169
|
-
return bucket.id;
|
|
157
|
+
return planner.getBucketIdByTitle(options.bucketName, planId);
|
|
170
158
|
}
|
|
171
159
|
async getPlanId(options) {
|
|
172
160
|
if (options.planId) {
|
|
173
161
|
return options.planId;
|
|
174
162
|
}
|
|
175
163
|
if (options.rosterId) {
|
|
176
|
-
|
|
177
|
-
return plan.id;
|
|
164
|
+
return planner.getPlanIdByRosterId(options.rosterId);
|
|
178
165
|
}
|
|
179
166
|
else {
|
|
180
167
|
const groupId = await this.getGroupId(options);
|
|
181
|
-
|
|
182
|
-
return plan.id;
|
|
168
|
+
return planner.getPlanIdByTitle(options.planTitle, groupId);
|
|
183
169
|
}
|
|
184
170
|
}
|
|
185
171
|
async getGroupId(options) {
|
|
186
172
|
if (options.ownerGroupId) {
|
|
187
173
|
return options.ownerGroupId;
|
|
188
174
|
}
|
|
189
|
-
|
|
190
|
-
return group.id;
|
|
175
|
+
return entraGroup.getGroupIdByDisplayName(options.ownerGroupName);
|
|
191
176
|
}
|
|
192
177
|
mapRequestBody(options, appliedCategories) {
|
|
193
178
|
const requestBody = {};
|
|
@@ -266,8 +251,17 @@ _PlannerTaskSetCommand_instances = new WeakSet(), _PlannerTaskSetCommand_initTel
|
|
|
266
251
|
if (args.options.percentComplete && (args.options.percentComplete < 0 || args.options.percentComplete > 100)) {
|
|
267
252
|
return `percentComplete should be between 0 and 100`;
|
|
268
253
|
}
|
|
269
|
-
if (args.options.assignedToUserIds
|
|
270
|
-
|
|
254
|
+
if (args.options.assignedToUserIds) {
|
|
255
|
+
const isValidGUIDArrayResult = validation.isValidGuidArray(args.options.assignedToUserIds);
|
|
256
|
+
if (isValidGUIDArrayResult !== true) {
|
|
257
|
+
return `The following GUIDs are invalid for the option 'assignedToUserIds': ${isValidGUIDArrayResult}.`;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (args.options.assignedToUserNames) {
|
|
261
|
+
const isValidUPNArrayResult = validation.isValidUserPrincipalNameArray(args.options.assignedToUserNames);
|
|
262
|
+
if (isValidUPNArrayResult !== true) {
|
|
263
|
+
return `The following user principal names are invalid for the option 'assignedToUserNames': ${isValidUPNArrayResult}.`;
|
|
264
|
+
}
|
|
271
265
|
}
|
|
272
266
|
if (args.options.appliedCategories && args.options.appliedCategories.split(',').filter(category => this.allowedAppliedCategories.indexOf(category.toLocaleLowerCase()) < 0).length !== 0) {
|
|
273
267
|
return 'The appliedCategories contains invalid value. Specify either category1, category2, category3, category4, category5 and/or category6 as properties';
|