@pnp/cli-microsoft365 5.3.0-beta.e83e121 → 5.3.0-beta.ebb13d0
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 +5 -0
- package/dist/m365/aad/commands/app/app-add.js +91 -35
- package/dist/m365/aad/commands/app/app-role-list.js +1 -1
- package/dist/m365/aad/commands/app/app-set.js +91 -0
- package/dist/m365/aad/commands/group/group-list.js +1 -1
- package/dist/m365/aad/commands/groupsetting/groupsetting-list.js +1 -1
- package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-get.js +1 -1
- package/dist/m365/aad/commands/groupsettingtemplate/groupsettingtemplate-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-conversation-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-conversation-post-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-clear.js +3 -3
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-list.js +1 -1
- package/dist/m365/aad/commands/o365group/o365group-user-list.js +2 -2
- package/dist/m365/aad/commands/o365group/o365group-user-set.js +2 -2
- package/dist/m365/aad/commands/user/user-list.js +1 -1
- package/dist/m365/aad/commands/user/user-signin-list.js +1 -1
- package/dist/m365/base/PowerBICommand.js +10 -0
- package/dist/m365/file/commands/file-list.js +1 -1
- package/dist/m365/outlook/commands/message/message-list.js +1 -1
- package/dist/m365/outlook/commands/room/room-list.js +1 -1
- package/dist/m365/outlook/commands/roomlist/roomlist-list.js +1 -1
- package/dist/m365/planner/commands/bucket/bucket-add.js +8 -16
- package/dist/m365/planner/commands/bucket/bucket-get.js +8 -20
- package/dist/m365/planner/commands/bucket/bucket-list.js +10 -19
- package/dist/m365/planner/commands/bucket/bucket-remove.js +8 -20
- package/dist/m365/planner/commands/bucket/bucket-set.js +9 -21
- package/dist/m365/planner/commands/plan/plan-add.js +6 -1
- package/dist/m365/planner/commands/plan/plan-details-get.js +12 -15
- package/dist/m365/planner/commands/plan/plan-get.js +13 -18
- package/dist/m365/planner/commands/plan/plan-list.js +10 -13
- package/dist/m365/planner/commands/task/task-add.js +8 -16
- package/dist/m365/planner/commands/task/task-details-get.js +6 -0
- package/dist/m365/planner/commands/task/task-get.js +11 -23
- package/dist/m365/planner/commands/task/task-list.js +15 -24
- package/dist/m365/planner/commands/task/task-reference-add.js +75 -0
- package/dist/m365/planner/commands/task/task-reference-list.js +45 -0
- package/dist/m365/planner/commands/task/task-set.js +9 -18
- package/dist/m365/planner/commands.js +3 -1
- package/dist/m365/pp/commands/gateway/gateway-list.js +36 -0
- package/dist/m365/pp/commands/managementapp/managementapp-list.js +1 -1
- package/dist/m365/pp/commands.js +1 -0
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-break.js +83 -0
- package/dist/m365/spo/commands/listitem/listitem-roleinheritance-reset.js +79 -0
- package/dist/m365/spo/commands.js +2 -0
- package/dist/m365/teams/commands/app/app-list.js +1 -1
- package/dist/m365/teams/commands/channel/channel-list.js +1 -1
- package/dist/m365/teams/commands/channel/channel-member-add.js +4 -1
- package/dist/m365/teams/commands/channel/channel-member-list.js +1 -1
- package/dist/m365/teams/commands/channel/channel-member-remove.js +3 -0
- package/dist/m365/teams/commands/channel/channel-member-set.js +3 -0
- package/dist/m365/teams/commands/chat/chat-get.js +8 -8
- package/dist/m365/teams/commands/chat/chat-list.js +1 -1
- package/dist/m365/teams/commands/chat/chat-member-list.js +1 -1
- package/dist/m365/teams/commands/chat/chat-message-list.js +1 -1
- package/dist/m365/teams/commands/chat/chat-message-send.js +6 -6
- package/dist/m365/teams/commands/chat/chatUtil.js +4 -4
- package/dist/m365/teams/commands/message/message-list.js +1 -1
- package/dist/m365/teams/commands/message/message-reply-list.js +1 -1
- package/dist/m365/teams/commands/tab/tab-list.js +1 -1
- package/dist/m365/teams/commands/team/team-list.js +1 -1
- package/dist/m365/teams/commands/user/user-app-list.js +1 -1
- package/dist/m365/teams/commands/user/user-list.js +2 -2
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-healthissue-list.js +1 -1
- package/dist/m365/tenant/commands/serviceannouncement/serviceannouncement-message-list.js +1 -1
- package/dist/m365/todo/commands/list/list-list.js +1 -1
- package/dist/m365/todo/commands/task/task-list.js +1 -1
- package/dist/utils/accessToken.js +18 -0
- package/dist/utils/formatting.js +11 -2
- package/dist/utils/odata.js +2 -2
- package/dist/utils/planner.js +65 -0
- package/docs/docs/cmd/aad/app/app-add.md +15 -0
- package/docs/docs/cmd/aad/app/app-set.md +17 -0
- package/docs/docs/cmd/aad/approleassignment/approleassignment-remove.md +1 -1
- package/docs/docs/cmd/planner/task/task-reference-add.md +45 -0
- package/docs/docs/cmd/planner/task/task-reference-list.md +24 -0
- package/docs/docs/cmd/pp/gateway/gateway-list.md +21 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-break.md +58 -0
- package/docs/docs/cmd/spo/listitem/listitem-roleinheritance-reset.md +39 -0
- package/docs/docs/cmd/spo/userprofile/userprofile-get.md +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
3
|
const utils_1 = require("../../../../utils");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const planner_1 = require("../../../../utils/planner");
|
|
6
|
+
const Auth_1 = require("../../../../Auth");
|
|
5
7
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
8
|
const commands_1 = require("../../commands");
|
|
7
9
|
class PlannerBucketListCommand extends GraphCommand_1.default {
|
|
@@ -23,9 +25,13 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
|
|
|
23
25
|
return ['id', 'name', 'planId', 'orderHint'];
|
|
24
26
|
}
|
|
25
27
|
commandAction(logger, args, cb) {
|
|
28
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
29
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
26
32
|
this
|
|
27
33
|
.getPlanId(args)
|
|
28
|
-
.then((planId) => utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/buckets
|
|
34
|
+
.then((planId) => utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/buckets`))
|
|
29
35
|
.then((buckets) => {
|
|
30
36
|
logger.log(buckets);
|
|
31
37
|
cb();
|
|
@@ -37,23 +43,8 @@ class PlannerBucketListCommand extends GraphCommand_1.default {
|
|
|
37
43
|
}
|
|
38
44
|
return this
|
|
39
45
|
.getGroupId(args)
|
|
40
|
-
.then(
|
|
41
|
-
|
|
42
|
-
url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')`,
|
|
43
|
-
headers: {
|
|
44
|
-
accept: 'application/json;odata.metadata=none'
|
|
45
|
-
},
|
|
46
|
-
responseType: 'json'
|
|
47
|
-
};
|
|
48
|
-
return request_1.default.get(requestOptions);
|
|
49
|
-
})
|
|
50
|
-
.then(response => {
|
|
51
|
-
const plan = response.value.find(val => val.title === args.options.planName);
|
|
52
|
-
if (!plan) {
|
|
53
|
-
return Promise.reject(`The specified plan does not exist`);
|
|
54
|
-
}
|
|
55
|
-
return Promise.resolve(plan.id);
|
|
56
|
-
});
|
|
46
|
+
.then(groupId => planner_1.planner.getPlanByName(args.options.planName, groupId))
|
|
47
|
+
.then(plan => plan.id);
|
|
57
48
|
}
|
|
58
49
|
getGroupId(args) {
|
|
59
50
|
if (args.options.ownerGroupId) {
|
|
@@ -5,6 +5,8 @@ const utils_1 = require("../../../../utils");
|
|
|
5
5
|
const request_1 = require("../../../../request");
|
|
6
6
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
7
7
|
const commands_1 = require("../../commands");
|
|
8
|
+
const planner_1 = require("../../../../utils/planner");
|
|
9
|
+
const Auth_1 = require("../../../../Auth");
|
|
8
10
|
class PlannerBucketRemoveCommand extends GraphCommand_1.default {
|
|
9
11
|
get name() {
|
|
10
12
|
return commands_1.default.BUCKET_REMOVE;
|
|
@@ -24,6 +26,10 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
|
|
|
24
26
|
return telemetryProps;
|
|
25
27
|
}
|
|
26
28
|
commandAction(logger, args, cb) {
|
|
29
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
30
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
27
33
|
const removeBucket = () => {
|
|
28
34
|
this
|
|
29
35
|
.getBucket(args)
|
|
@@ -100,26 +106,8 @@ class PlannerBucketRemoveCommand extends GraphCommand_1.default {
|
|
|
100
106
|
}
|
|
101
107
|
return this
|
|
102
108
|
.getGroupId(args)
|
|
103
|
-
.then(groupId =>
|
|
104
|
-
|
|
105
|
-
url: `${this.resource}/v1.0/planner/plans?$filter=owner eq '${groupId}'`,
|
|
106
|
-
headers: {
|
|
107
|
-
accept: 'application/json;odata.metadata=none'
|
|
108
|
-
},
|
|
109
|
-
responseType: 'json'
|
|
110
|
-
};
|
|
111
|
-
return request_1.default.get(requestOptions);
|
|
112
|
-
})
|
|
113
|
-
.then(plans => {
|
|
114
|
-
const filteredPlans = plans.value.filter(p => p.title.toLowerCase() === planName.toLowerCase());
|
|
115
|
-
if (!filteredPlans.length) {
|
|
116
|
-
return Promise.reject(`The specified plan ${planName} does not exist`);
|
|
117
|
-
}
|
|
118
|
-
if (filteredPlans.length > 1) {
|
|
119
|
-
return Promise.reject(`Multiple plans with name ${planName} found: ${filteredPlans.map(x => x.id)}`);
|
|
120
|
-
}
|
|
121
|
-
return Promise.resolve(filteredPlans[0].id);
|
|
122
|
-
});
|
|
109
|
+
.then(groupId => planner_1.planner.getPlanByName(planName, groupId))
|
|
110
|
+
.then(plan => plan.id);
|
|
123
111
|
}
|
|
124
112
|
getGroupId(args) {
|
|
125
113
|
const { ownerGroupId, ownerGroupName } = args.options;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
3
|
const utils_1 = require("../../../../utils");
|
|
5
4
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
|
+
const Auth_1 = require("../../../../Auth");
|
|
6
|
+
const request_1 = require("../../../../request");
|
|
7
|
+
const planner_1 = require("../../../../utils/planner");
|
|
6
8
|
const commands_1 = require("../../commands");
|
|
7
9
|
class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
8
10
|
get name() {
|
|
@@ -24,6 +26,10 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
24
26
|
return telemetryProps;
|
|
25
27
|
}
|
|
26
28
|
commandAction(logger, args, cb) {
|
|
29
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
30
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
27
33
|
this
|
|
28
34
|
.getBucket(args)
|
|
29
35
|
.then(bucket => {
|
|
@@ -88,26 +94,8 @@ class PlannerBucketSetCommand extends GraphCommand_1.default {
|
|
|
88
94
|
}
|
|
89
95
|
return this
|
|
90
96
|
.getGroupId(args)
|
|
91
|
-
.then(groupId =>
|
|
92
|
-
|
|
93
|
-
url: `${this.resource}/v1.0/planner/plans?$filter=owner eq '${groupId}'`,
|
|
94
|
-
headers: {
|
|
95
|
-
accept: 'application/json;odata.metadata=none'
|
|
96
|
-
},
|
|
97
|
-
responseType: 'json'
|
|
98
|
-
};
|
|
99
|
-
return request_1.default.get(requestOptions);
|
|
100
|
-
})
|
|
101
|
-
.then(plans => {
|
|
102
|
-
const filteredPlans = plans.value.filter(p => p.title.toLowerCase() === planName.toLowerCase());
|
|
103
|
-
if (filteredPlans.length === 0) {
|
|
104
|
-
return Promise.reject(`The specified plan ${planName} does not exist`);
|
|
105
|
-
}
|
|
106
|
-
if (filteredPlans.length > 1) {
|
|
107
|
-
return Promise.reject(`Multiple plans with name ${planName} found: ${filteredPlans.map(x => x.id)}`);
|
|
108
|
-
}
|
|
109
|
-
return Promise.resolve(filteredPlans[0].id);
|
|
110
|
-
});
|
|
97
|
+
.then(groupId => planner_1.planner.getPlanByName(planName, groupId))
|
|
98
|
+
.then(plan => plan.id);
|
|
111
99
|
}
|
|
112
100
|
getGroupId(args) {
|
|
113
101
|
const { ownerGroupId, ownerGroupName } = args.options;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
3
|
const utils_1 = require("../../../../utils");
|
|
4
|
+
const Auth_1 = require("../../../../Auth");
|
|
5
|
+
const request_1 = require("../../../../request");
|
|
5
6
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
7
|
const commands_1 = require("../../commands");
|
|
7
8
|
class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
@@ -21,6 +22,10 @@ class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
|
21
22
|
return ['id', 'title', 'createdDateTime', 'owner'];
|
|
22
23
|
}
|
|
23
24
|
commandAction(logger, args, cb) {
|
|
25
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
26
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
24
29
|
this
|
|
25
30
|
.getGroupId(args)
|
|
26
31
|
.then((groupId) => {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
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");
|
|
5
7
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
8
|
const commands_1 = require("../../commands");
|
|
7
9
|
class PlannerPlanDetailsGetCommand extends GraphCommand_1.default {
|
|
@@ -24,11 +26,15 @@ class PlannerPlanDetailsGetCommand extends GraphCommand_1.default {
|
|
|
24
26
|
return telemetryProps;
|
|
25
27
|
}
|
|
26
28
|
commandAction(logger, args, cb) {
|
|
29
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
30
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
27
33
|
this
|
|
28
34
|
.getGroupId(args)
|
|
29
35
|
.then((groupId) => {
|
|
30
36
|
this.groupId = groupId;
|
|
31
|
-
return this.getPlanId(args
|
|
37
|
+
return this.getPlanId(args);
|
|
32
38
|
})
|
|
33
39
|
.then((planId) => {
|
|
34
40
|
args.options.planId = planId;
|
|
@@ -66,22 +72,13 @@ class PlannerPlanDetailsGetCommand extends GraphCommand_1.default {
|
|
|
66
72
|
return Promise.resolve(groupItem.id);
|
|
67
73
|
});
|
|
68
74
|
}
|
|
69
|
-
getPlanId(args
|
|
75
|
+
getPlanId(args) {
|
|
70
76
|
if (args.options.planId) {
|
|
71
77
|
return Promise.resolve(args.options.planId);
|
|
72
78
|
}
|
|
73
|
-
return
|
|
74
|
-
.
|
|
75
|
-
.then(
|
|
76
|
-
const plansMatchingName = plans.filter((plan) => plan.title === args.options.planTitle);
|
|
77
|
-
if (plansMatchingName && plansMatchingName.length > 0) {
|
|
78
|
-
if (plansMatchingName.length > 1) {
|
|
79
|
-
return Promise.reject(`Multiple plans with name ${args.options.planTitle} found: ${plansMatchingName.map(x => x.id)}`);
|
|
80
|
-
}
|
|
81
|
-
return Promise.resolve(plansMatchingName[0].id);
|
|
82
|
-
}
|
|
83
|
-
return Promise.reject(`The specified plan title does not exist`);
|
|
84
|
-
});
|
|
79
|
+
return planner_1.planner
|
|
80
|
+
.getPlanByName(args.options.planTitle, this.groupId)
|
|
81
|
+
.then(plan => plan.id);
|
|
85
82
|
}
|
|
86
83
|
getPlanDetails(args) {
|
|
87
84
|
const requestOptions = {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
3
|
const utils_1 = require("../../../../utils");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const planner_1 = require("../../../../utils/planner");
|
|
5
6
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
7
|
const commands_1 = require("../../commands");
|
|
8
|
+
const Auth_1 = require("../../../../Auth");
|
|
7
9
|
class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
8
10
|
get name() {
|
|
9
11
|
return commands_1.default.PLAN_GET;
|
|
@@ -23,9 +25,13 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
23
25
|
return ['id', 'title', 'createdDateTime', 'owner', '@odata.etag'];
|
|
24
26
|
}
|
|
25
27
|
commandAction(logger, args, cb) {
|
|
28
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
29
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
26
32
|
if (args.options.id) {
|
|
27
|
-
|
|
28
|
-
.
|
|
33
|
+
planner_1.planner
|
|
34
|
+
.getPlanById(args.options.id)
|
|
29
35
|
.then((res) => {
|
|
30
36
|
logger.log(res);
|
|
31
37
|
cb();
|
|
@@ -34,11 +40,10 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
34
40
|
else {
|
|
35
41
|
this
|
|
36
42
|
.getGroupId(args)
|
|
37
|
-
.then(
|
|
38
|
-
.then((
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
logger.log(filteredPlan);
|
|
43
|
+
.then(groupId => planner_1.planner.getPlanByName(args.options.title, groupId))
|
|
44
|
+
.then((plan) => {
|
|
45
|
+
if (plan) {
|
|
46
|
+
logger.log(plan);
|
|
42
47
|
}
|
|
43
48
|
cb();
|
|
44
49
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
@@ -65,16 +70,6 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
65
70
|
return Promise.resolve(group.id);
|
|
66
71
|
});
|
|
67
72
|
}
|
|
68
|
-
getPlan(args) {
|
|
69
|
-
const requestOptions = {
|
|
70
|
-
url: `${this.resource}/v1.0/planner/plans/${args.options.id}`,
|
|
71
|
-
headers: {
|
|
72
|
-
'accept': 'application/json'
|
|
73
|
-
},
|
|
74
|
-
responseType: 'json'
|
|
75
|
-
};
|
|
76
|
-
return request_1.default.get(requestOptions);
|
|
77
|
-
}
|
|
78
73
|
options() {
|
|
79
74
|
const options = [
|
|
80
75
|
{
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
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");
|
|
5
7
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
8
|
const commands_1 = require("../../commands");
|
|
7
9
|
class PlannerPlanListCommand extends GraphCommand_1.default {
|
|
@@ -21,21 +23,16 @@ class PlannerPlanListCommand extends GraphCommand_1.default {
|
|
|
21
23
|
return ['id', 'title', 'createdDateTime', 'owner'];
|
|
22
24
|
}
|
|
23
25
|
commandAction(logger, args, cb) {
|
|
26
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
27
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
24
30
|
this
|
|
25
31
|
.getGroupId(args)
|
|
26
|
-
.then((groupId) =>
|
|
27
|
-
const requestOptions = {
|
|
28
|
-
url: `${this.resource}/v1.0/groups/${groupId}/planner/plans`,
|
|
29
|
-
headers: {
|
|
30
|
-
'accept': 'application/json;odata.metadata=none'
|
|
31
|
-
},
|
|
32
|
-
responseType: 'json'
|
|
33
|
-
};
|
|
34
|
-
return request_1.default.get(requestOptions);
|
|
35
|
-
})
|
|
32
|
+
.then((groupId) => planner_1.planner.getPlansByGroupId(groupId))
|
|
36
33
|
.then((res) => {
|
|
37
|
-
if (res
|
|
38
|
-
logger.log(res
|
|
34
|
+
if (res && res.length > 0) {
|
|
35
|
+
logger.log(res);
|
|
39
36
|
}
|
|
40
37
|
cb();
|
|
41
38
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Auth_1 = require("../../../../Auth");
|
|
3
4
|
const request_1 = require("../../../../request");
|
|
5
|
+
const planner_1 = require("../../../../utils/planner");
|
|
4
6
|
const utils_1 = require("../../../../utils");
|
|
5
7
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
8
|
const commands_1 = require("../../commands");
|
|
@@ -29,6 +31,10 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
29
31
|
return telemetryProps;
|
|
30
32
|
}
|
|
31
33
|
commandAction(logger, args, cb) {
|
|
34
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
35
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
32
38
|
this
|
|
33
39
|
.getPlanId(args)
|
|
34
40
|
.then(planId => {
|
|
@@ -151,22 +157,8 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
151
157
|
}
|
|
152
158
|
return this
|
|
153
159
|
.getGroupId(args)
|
|
154
|
-
.then((groupId) =>
|
|
155
|
-
|
|
156
|
-
url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')`,
|
|
157
|
-
headers: {
|
|
158
|
-
accept: 'application/json;odata.metadata=none'
|
|
159
|
-
},
|
|
160
|
-
responseType: 'json'
|
|
161
|
-
};
|
|
162
|
-
return request_1.default.get(requestOptions);
|
|
163
|
-
}).then((response) => {
|
|
164
|
-
const plan = response.value.find(val => val.title === args.options.planName);
|
|
165
|
-
if (!plan) {
|
|
166
|
-
return Promise.reject(`The specified plan does not exist`);
|
|
167
|
-
}
|
|
168
|
-
return Promise.resolve(plan.id);
|
|
169
|
-
});
|
|
160
|
+
.then((groupId) => planner_1.planner.getPlanByName(args.options.planName, groupId))
|
|
161
|
+
.then(plan => plan.id);
|
|
170
162
|
}
|
|
171
163
|
getGroupId(args) {
|
|
172
164
|
if (args.options.ownerGroupId) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../../../../utils");
|
|
4
|
+
const Auth_1 = require("../../../../Auth");
|
|
3
5
|
const request_1 = require("../../../../request");
|
|
4
6
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
7
|
const commands_1 = require("../../commands");
|
|
@@ -11,6 +13,10 @@ class PlannerTaskDetailsGetCommand extends GraphCommand_1.default {
|
|
|
11
13
|
return 'Retrieve the details of the specified planner task';
|
|
12
14
|
}
|
|
13
15
|
commandAction(logger, args, cb) {
|
|
16
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
17
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
14
20
|
const requestOptions = {
|
|
15
21
|
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.taskId)}/details`,
|
|
16
22
|
headers: {
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
3
|
const utils_1 = require("../../../../utils");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const utils_2 = require("../../../../utils");
|
|
6
|
+
const planner_1 = require("../../../../utils/planner");
|
|
5
7
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
8
|
const commands_1 = require("../../commands");
|
|
9
|
+
const Auth_1 = require("../../../../Auth");
|
|
7
10
|
class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
8
11
|
get name() {
|
|
9
12
|
return commands_1.default.TASK_GET;
|
|
@@ -12,6 +15,10 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
12
15
|
return 'Retrieve the the specified planner task';
|
|
13
16
|
}
|
|
14
17
|
commandAction(logger, args, cb) {
|
|
18
|
+
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
19
|
+
this.handleError('This command does not support application permissions.', logger, cb);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
15
22
|
this
|
|
16
23
|
.getTaskId(args.options)
|
|
17
24
|
.then(taskId => {
|
|
@@ -91,27 +98,8 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
91
98
|
}
|
|
92
99
|
return this
|
|
93
100
|
.getGroupId(options)
|
|
94
|
-
.then(
|
|
95
|
-
|
|
96
|
-
url: `${this.resource}/v1.0/planner/plans?$filter=owner eq '${groupId}'&$select=id,title`,
|
|
97
|
-
headers: {
|
|
98
|
-
accept: 'application/json;odata.metadata=none'
|
|
99
|
-
},
|
|
100
|
-
responseType: 'json'
|
|
101
|
-
};
|
|
102
|
-
return request_1.default.get(requestOptions);
|
|
103
|
-
})
|
|
104
|
-
.then((response) => {
|
|
105
|
-
const planName = options.planName;
|
|
106
|
-
const plans = response.value.filter(val => { var _a; return ((_a = val.title) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === planName.toLocaleLowerCase(); });
|
|
107
|
-
if (!plans.length) {
|
|
108
|
-
return Promise.reject(`The specified plan ${options.planName} does not exist`);
|
|
109
|
-
}
|
|
110
|
-
if (plans.length > 1) {
|
|
111
|
-
return Promise.reject(`Multiple plans with name ${options.planName} found: ${plans.map(x => x.id)}`);
|
|
112
|
-
}
|
|
113
|
-
return Promise.resolve(plans[0].id);
|
|
114
|
-
});
|
|
101
|
+
.then(groupId => planner_1.planner.getPlanByName(options.planName, groupId))
|
|
102
|
+
.then(plan => plan.id);
|
|
115
103
|
}
|
|
116
104
|
getGroupId(options) {
|
|
117
105
|
if (options.ownerGroupId) {
|
|
@@ -170,7 +158,7 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
170
158
|
if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
171
159
|
return 'Specify either ownerGroupId or ownerGroupName when using planName but not both';
|
|
172
160
|
}
|
|
173
|
-
if (args.options.ownerGroupId && !
|
|
161
|
+
if (args.options.ownerGroupId && !utils_2.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
174
162
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
175
163
|
}
|
|
176
164
|
return true;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const request_1 = require("../../../../request");
|
|
4
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");
|
|
5
7
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
8
|
const commands_1 = require("../../commands");
|
|
7
9
|
class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
@@ -25,6 +27,10 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
25
27
|
return ['id', 'title', 'startDateTime', 'dueDateTime', 'completedDateTime'];
|
|
26
28
|
}
|
|
27
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
|
+
}
|
|
28
34
|
const bucketName = args.options.bucketName;
|
|
29
35
|
let bucketId = args.options.bucketId;
|
|
30
36
|
const planName = args.options.planName;
|
|
@@ -35,11 +41,11 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
35
41
|
.getBucketId(args)
|
|
36
42
|
.then((retrievedBucketId) => {
|
|
37
43
|
bucketId = retrievedBucketId;
|
|
38
|
-
return utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/buckets/${bucketId}/tasks
|
|
44
|
+
return utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/buckets/${bucketId}/tasks`);
|
|
39
45
|
})
|
|
40
46
|
.then((tasks) => {
|
|
41
47
|
taskItems = tasks;
|
|
42
|
-
return utils_1.odata.getAllItems(`${this.resource}/beta/planner/buckets/${bucketId}/tasks
|
|
48
|
+
return utils_1.odata.getAllItems(`${this.resource}/beta/planner/buckets/${bucketId}/tasks`);
|
|
43
49
|
})
|
|
44
50
|
.then((betaTasks) => {
|
|
45
51
|
logger.log(this.mergeTaskPriority(taskItems, betaTasks));
|
|
@@ -51,11 +57,11 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
51
57
|
.getPlanId(args)
|
|
52
58
|
.then((retrievedPlanId) => {
|
|
53
59
|
planId = retrievedPlanId;
|
|
54
|
-
return utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/tasks
|
|
60
|
+
return utils_1.odata.getAllItems(`${this.resource}/v1.0/planner/plans/${planId}/tasks`);
|
|
55
61
|
})
|
|
56
62
|
.then((tasks) => {
|
|
57
63
|
taskItems = tasks;
|
|
58
|
-
return utils_1.odata.getAllItems(`${this.resource}/beta/planner/plans/${planId}/tasks
|
|
64
|
+
return utils_1.odata.getAllItems(`${this.resource}/beta/planner/plans/${planId}/tasks`);
|
|
59
65
|
})
|
|
60
66
|
.then((betaTasks) => {
|
|
61
67
|
logger.log(this.mergeTaskPriority(taskItems, betaTasks));
|
|
@@ -64,10 +70,10 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
64
70
|
}
|
|
65
71
|
else {
|
|
66
72
|
utils_1.odata
|
|
67
|
-
.getAllItems(`${this.resource}/v1.0/me/planner/tasks
|
|
73
|
+
.getAllItems(`${this.resource}/v1.0/me/planner/tasks`)
|
|
68
74
|
.then((tasks) => {
|
|
69
75
|
taskItems = tasks;
|
|
70
|
-
return utils_1.odata.getAllItems(`${this.resource}/beta/me/planner/tasks
|
|
76
|
+
return utils_1.odata.getAllItems(`${this.resource}/beta/me/planner/tasks`);
|
|
71
77
|
})
|
|
72
78
|
.then((betaTasks) => {
|
|
73
79
|
logger.log(this.mergeTaskPriority(taskItems, betaTasks));
|
|
@@ -105,23 +111,8 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
105
111
|
}
|
|
106
112
|
return this
|
|
107
113
|
.getGroupId(args)
|
|
108
|
-
.then((groupId) =>
|
|
109
|
-
|
|
110
|
-
url: `${this.resource}/v1.0/planner/plans?$filter=(owner eq '${groupId}')`,
|
|
111
|
-
headers: {
|
|
112
|
-
accept: 'application/json;odata.metadata=none'
|
|
113
|
-
},
|
|
114
|
-
responseType: 'json'
|
|
115
|
-
};
|
|
116
|
-
return request_1.default.get(requestOptions);
|
|
117
|
-
})
|
|
118
|
-
.then(response => {
|
|
119
|
-
const plan = response.value.find(val => val.title === args.options.planName);
|
|
120
|
-
if (!plan) {
|
|
121
|
-
return Promise.reject(`The specified plan does not exist`);
|
|
122
|
-
}
|
|
123
|
-
return Promise.resolve(plan.id);
|
|
124
|
-
});
|
|
114
|
+
.then((groupId) => planner_1.planner.getPlanByName(args.options.planName, groupId))
|
|
115
|
+
.then(plan => plan.id);
|
|
125
116
|
}
|
|
126
117
|
getGroupId(args) {
|
|
127
118
|
if (args.options.ownerGroupId) {
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const utils_1 = require("../../../../utils");
|
|
5
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
|
+
const commands_1 = require("../../commands");
|
|
7
|
+
class PlannerTaskReferenceAddCommand extends GraphCommand_1.default {
|
|
8
|
+
get name() {
|
|
9
|
+
return commands_1.default.TASK_REFERENCE_ADD;
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Adds a new reference to a Planner task';
|
|
13
|
+
}
|
|
14
|
+
commandAction(logger, args, cb) {
|
|
15
|
+
this
|
|
16
|
+
.getTaskDetailsEtag(args.options.taskId)
|
|
17
|
+
.then(etag => {
|
|
18
|
+
const requestOptionsTaskDetails = {
|
|
19
|
+
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(args.options.taskId)}/details`,
|
|
20
|
+
headers: {
|
|
21
|
+
'accept': 'application/json;odata.metadata=none',
|
|
22
|
+
'If-Match': etag,
|
|
23
|
+
'Prefer': 'return=representation'
|
|
24
|
+
},
|
|
25
|
+
responseType: 'json',
|
|
26
|
+
data: {
|
|
27
|
+
references: {
|
|
28
|
+
[utils_1.formatting.openTypesEncoder(args.options.url)]: Object.assign(Object.assign({ '@odata.type': 'microsoft.graph.plannerExternalReference', previewPriority: ' !' }, (args.options.alias && { alias: args.options.alias })), (args.options.type && { type: args.options.type }))
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return request_1.default.patch(requestOptionsTaskDetails);
|
|
33
|
+
})
|
|
34
|
+
.then((res) => {
|
|
35
|
+
logger.log(res.references);
|
|
36
|
+
cb();
|
|
37
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
38
|
+
}
|
|
39
|
+
getTaskDetailsEtag(taskId) {
|
|
40
|
+
const requestOptions = {
|
|
41
|
+
url: `${this.resource}/v1.0/planner/tasks/${encodeURIComponent(taskId)}/details`,
|
|
42
|
+
headers: {
|
|
43
|
+
accept: 'application/json'
|
|
44
|
+
},
|
|
45
|
+
responseType: 'json'
|
|
46
|
+
};
|
|
47
|
+
return request_1.default
|
|
48
|
+
.get(requestOptions)
|
|
49
|
+
.then((response) => {
|
|
50
|
+
const etag = response ? response['@odata.etag'] : undefined;
|
|
51
|
+
if (!etag) {
|
|
52
|
+
return Promise.reject(`Error fetching task details`);
|
|
53
|
+
}
|
|
54
|
+
return Promise.resolve(etag);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
options() {
|
|
58
|
+
const options = [
|
|
59
|
+
{ option: '-i, --taskId <taskId>' },
|
|
60
|
+
{ option: '-u, --url <url>' },
|
|
61
|
+
{ option: '--alias [alias]' },
|
|
62
|
+
{ option: '--type [type]' }
|
|
63
|
+
];
|
|
64
|
+
const parentOptions = super.options();
|
|
65
|
+
return options.concat(parentOptions);
|
|
66
|
+
}
|
|
67
|
+
validate(args) {
|
|
68
|
+
if (args.options.type && ['powerpoint', 'word', 'excel', 'other'].indexOf(args.options.type.toLocaleLowerCase()) === -1) {
|
|
69
|
+
return `${args.options.type} is not a valid type value. Allowed values PowerPoint|Word|Excel|Other`;
|
|
70
|
+
}
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
module.exports = new PlannerTaskReferenceAddCommand();
|
|
75
|
+
//# sourceMappingURL=task-reference-add.js.map
|