@pnp/cli-microsoft365 6.0.0-beta.f73c4f8 → 6.0.0-beta.f94d570
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 +2 -2
- package/dist/m365/aad/commands/app/app-remove.js +0 -4
- package/dist/m365/aad/commands/app/app-role-remove.js +0 -4
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +60 -9
- package/dist/m365/aad/commands.js +0 -2
- package/dist/m365/base/PowerAppsCommand.js +10 -0
- package/dist/m365/pa/commands/app/app-get.js +3 -5
- package/dist/m365/pa/commands/app/app-list.js +10 -9
- package/dist/m365/pa/commands/app/app-remove.js +3 -3
- package/dist/m365/pa/commands/connector/connector-export.js +3 -3
- package/dist/m365/pa/commands/connector/connector-list.js +10 -9
- package/dist/m365/pa/commands/environment/environment-get.js +3 -3
- package/dist/m365/pa/commands/environment/environment-list.js +4 -4
- package/dist/m365/planner/commands/bucket/bucket-add.js +4 -12
- package/dist/m365/planner/commands/bucket/bucket-get.js +4 -12
- package/dist/m365/planner/commands/bucket/bucket-list.js +4 -12
- package/dist/m365/planner/commands/bucket/bucket-remove.js +4 -12
- package/dist/m365/planner/commands/bucket/bucket-set.js +4 -12
- package/dist/m365/planner/commands/plan/plan-add.js +98 -5
- package/dist/m365/planner/commands/plan/plan-get.js +0 -4
- package/dist/m365/planner/commands/task/task-add.js +4 -10
- package/dist/m365/planner/commands/task/task-get.js +4 -19
- package/dist/m365/planner/commands/task/task-list.js +4 -12
- package/dist/m365/planner/commands/task/task-set.js +4 -10
- package/dist/m365/planner/commands.js +0 -2
- package/dist/m365/spo/commands/customaction/customaction-get.js +32 -4
- package/dist/m365/spo/commands/customaction/customaction-remove.js +43 -8
- package/dist/m365/spo/commands/field/field-get.js +14 -5
- package/dist/m365/spo/commands/field/field-remove.js +19 -10
- package/dist/m365/spo/commands/field/field-set.js +16 -9
- package/dist/m365/spo/commands/file/file-rename.js +108 -0
- package/dist/m365/spo/commands/group/group-add.js +96 -0
- package/dist/m365/spo/commands/group/group-get.js +26 -6
- package/dist/m365/spo/commands/group/group-set.js +167 -0
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +38 -2
- package/dist/m365/spo/commands/list/list-list.js +1 -10
- package/dist/m365/spo/commands/listitem/listitem-get.js +9 -9
- package/dist/m365/spo/commands/listitem/listitem-list.js +9 -26
- package/dist/m365/spo/commands/site/site-apppermission-add.js +3 -6
- package/dist/m365/spo/commands/site/site-apppermission-set.js +3 -6
- package/dist/m365/spo/commands/site/site-list.js +47 -16
- package/dist/m365/spo/commands/site/site-set.js +322 -162
- package/dist/m365/spo/commands/tenant/tenant-appcatalog-add.js +9 -6
- package/dist/m365/spo/commands.js +3 -3
- package/dist/m365/teams/commands/tab/tab-get.js +2 -2
- package/dist/m365/teams/commands/team/team-archive.js +51 -15
- package/dist/m365/teams/commands/team/team-clone.js +33 -7
- package/dist/m365/teams/commands/team/team-remove.js +47 -11
- package/dist/m365/teams/commands/team/team-set.js +25 -5
- package/dist/m365/teams/commands/team/team-unarchive.js +48 -12
- package/docs/docs/cmd/aad/app/app-remove.md +0 -6
- package/docs/docs/cmd/aad/app/app-role-remove.md +0 -6
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-restore.md +21 -3
- package/docs/docs/cmd/planner/bucket/bucket-add.md +0 -3
- package/docs/docs/cmd/planner/bucket/bucket-get.md +0 -3
- package/docs/docs/cmd/planner/bucket/bucket-list.md +0 -3
- package/docs/docs/cmd/planner/bucket/bucket-remove.md +0 -3
- package/docs/docs/cmd/planner/bucket/bucket-set.md +0 -3
- package/docs/docs/cmd/planner/plan/plan-add.md +18 -2
- package/docs/docs/cmd/planner/plan/plan-get.md +0 -6
- package/docs/docs/cmd/planner/task/task-add.md +0 -3
- package/docs/docs/cmd/planner/task/task-get.md +6 -3
- package/docs/docs/cmd/planner/task/task-list.md +0 -3
- package/docs/docs/cmd/planner/task/task-set.md +0 -3
- package/docs/docs/cmd/spo/customaction/customaction-get.md +15 -2
- package/docs/docs/cmd/spo/customaction/customaction-remove.md +33 -2
- package/docs/docs/cmd/spo/field/field-get.md +6 -3
- package/docs/docs/cmd/spo/field/field-remove.md +9 -6
- package/docs/docs/cmd/spo/field/field-set.md +7 -4
- package/docs/docs/cmd/spo/file/file-rename.md +43 -0
- package/docs/docs/cmd/spo/group/group-add.md +51 -0
- package/docs/docs/cmd/spo/group/group-get.md +12 -3
- package/docs/docs/cmd/spo/group/group-set.md +69 -0
- package/docs/docs/cmd/spo/hubsite/hubsite-get.md +21 -0
- package/docs/docs/cmd/spo/list/list-list.md +0 -3
- package/docs/docs/cmd/spo/listitem/listitem-get.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-list.md +8 -6
- package/docs/docs/cmd/spo/site/site-apppermission-add.md +1 -1
- package/docs/docs/cmd/spo/site/site-apppermission-set.md +1 -1
- package/docs/docs/cmd/spo/site/site-list.md +19 -7
- package/docs/docs/cmd/spo/site/site-set.md +50 -6
- package/docs/docs/cmd/teams/tab/tab-get.md +2 -2
- package/docs/docs/cmd/teams/team/team-archive.md +20 -5
- package/docs/docs/cmd/teams/team/team-clone.md +11 -5
- package/docs/docs/cmd/teams/team/team-remove.md +19 -5
- package/docs/docs/cmd/teams/team/team-set.md +10 -4
- package/docs/docs/cmd/teams/team/team-unarchive.md +18 -4
- package/npm-shrinkwrap.json +173 -158
- package/package.json +13 -13
- package/dist/m365/spo/commands/site/site-classic-add.js +0 -333
- package/dist/m365/spo/commands/site/site-classic-list.js +0 -98
- package/dist/m365/spo/commands/site/site-classic-set.js +0 -358
- package/docs/docs/cmd/spo/site/site-classic-add.md +0 -93
- package/docs/docs/cmd/spo/site/site-classic-list.md +0 -65
- package/docs/docs/cmd/spo/site/site-classic-set.md +0 -99
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("../../../../utils");
|
|
4
3
|
const Auth_1 = require("../../../../Auth");
|
|
5
4
|
const request_1 = require("../../../../request");
|
|
5
|
+
const utils_1 = require("../../../../utils");
|
|
6
6
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
7
7
|
const commands_1 = require("../../commands");
|
|
8
|
-
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
9
8
|
class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
10
9
|
get name() {
|
|
11
10
|
return commands_1.default.PLAN_ADD;
|
|
@@ -17,6 +16,8 @@ class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
|
17
16
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
18
17
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
19
18
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
19
|
+
telemetryProps.shareWithUserIds = typeof args.options.shareWithUserIds !== 'undefined';
|
|
20
|
+
telemetryProps.shareWithUserNames = typeof args.options.shareWithUserNames !== 'undefined';
|
|
20
21
|
return telemetryProps;
|
|
21
22
|
}
|
|
22
23
|
defaultProperties() {
|
|
@@ -43,16 +44,96 @@ class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
|
43
44
|
};
|
|
44
45
|
return request_1.default.post(requestOptions);
|
|
45
46
|
})
|
|
47
|
+
.then(newPlan => this.updatePlanDetails(args.options, newPlan))
|
|
46
48
|
.then((res) => {
|
|
47
49
|
logger.log(res);
|
|
48
50
|
cb();
|
|
49
51
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
50
52
|
}
|
|
53
|
+
updatePlanDetails(options, newPlan) {
|
|
54
|
+
const planId = newPlan.id;
|
|
55
|
+
if (!options.shareWithUserIds && !options.shareWithUserNames) {
|
|
56
|
+
return Promise.resolve(newPlan);
|
|
57
|
+
}
|
|
58
|
+
return Promise
|
|
59
|
+
.all([this.generateSharedWith(options), this.getPlanDetailsEtag(planId)])
|
|
60
|
+
.then(resArray => {
|
|
61
|
+
const sharedWith = resArray[0];
|
|
62
|
+
const etag = resArray[1];
|
|
63
|
+
const requestOptionsPlanDetails = {
|
|
64
|
+
url: `${this.resource}/v1.0/planner/plans/${planId}/details`,
|
|
65
|
+
headers: {
|
|
66
|
+
'accept': 'application/json;odata.metadata=none',
|
|
67
|
+
'If-Match': etag,
|
|
68
|
+
'Prefer': 'return=representation'
|
|
69
|
+
},
|
|
70
|
+
responseType: 'json',
|
|
71
|
+
data: {
|
|
72
|
+
sharedWith: sharedWith
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return request_1.default.patch(requestOptionsPlanDetails);
|
|
76
|
+
})
|
|
77
|
+
.then(planDetails => {
|
|
78
|
+
return Object.assign(Object.assign({}, newPlan), planDetails);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
getPlanDetailsEtag(planId) {
|
|
82
|
+
const requestOptions = {
|
|
83
|
+
url: `${this.resource}/v1.0/planner/plans/${planId}/details`,
|
|
84
|
+
headers: {
|
|
85
|
+
accept: 'application/json'
|
|
86
|
+
},
|
|
87
|
+
responseType: 'json'
|
|
88
|
+
};
|
|
89
|
+
return request_1.default
|
|
90
|
+
.get(requestOptions)
|
|
91
|
+
.then((response) => response['@odata.etag']);
|
|
92
|
+
}
|
|
93
|
+
generateSharedWith(options) {
|
|
94
|
+
const sharedWith = {};
|
|
95
|
+
return this
|
|
96
|
+
.getUserIds(options)
|
|
97
|
+
.then((userIds) => {
|
|
98
|
+
userIds.map(x => sharedWith[x] = true);
|
|
99
|
+
return Promise.resolve(sharedWith);
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
getUserIds(options) {
|
|
103
|
+
if (options.shareWithUserIds) {
|
|
104
|
+
return Promise.resolve(options.shareWithUserIds.split(','));
|
|
105
|
+
}
|
|
106
|
+
// Hitting this section means assignedToUserNames won't be undefined
|
|
107
|
+
const userNames = options.shareWithUserNames;
|
|
108
|
+
const userArr = userNames.split(',').map(o => o.trim());
|
|
109
|
+
const promises = userArr.map(user => {
|
|
110
|
+
const requestOptions = {
|
|
111
|
+
url: `${this.resource}/v1.0/users?$filter=userPrincipalName eq '${utils_1.formatting.encodeQueryParameter(user)}'&$select=id,userPrincipalName`,
|
|
112
|
+
headers: {
|
|
113
|
+
'content-type': 'application/json'
|
|
114
|
+
},
|
|
115
|
+
responseType: 'json'
|
|
116
|
+
};
|
|
117
|
+
return request_1.default.get(requestOptions);
|
|
118
|
+
});
|
|
119
|
+
return Promise
|
|
120
|
+
.all(promises)
|
|
121
|
+
.then((usersRes) => {
|
|
122
|
+
const userUpns = usersRes.map(res => { var _a; return (_a = res.value[0]) === null || _a === void 0 ? void 0 : _a.userPrincipalName; });
|
|
123
|
+
const userIds = usersRes.map(res => { var _a; return (_a = res.value[0]) === null || _a === void 0 ? void 0 : _a.id; });
|
|
124
|
+
// Find the members where no graph response was found
|
|
125
|
+
const invalidUsers = userArr.filter(user => !userUpns.some((upn) => (upn === null || upn === void 0 ? void 0 : upn.toLowerCase()) === user.toLowerCase()));
|
|
126
|
+
if (invalidUsers && invalidUsers.length > 0) {
|
|
127
|
+
return Promise.reject(`Cannot proceed with planner plan creation. The following users provided are invalid : ${invalidUsers.join(',')}`);
|
|
128
|
+
}
|
|
129
|
+
return Promise.resolve(userIds);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
51
132
|
getGroupId(args) {
|
|
52
133
|
if (args.options.ownerGroupId) {
|
|
53
134
|
return Promise.resolve(args.options.ownerGroupId);
|
|
54
135
|
}
|
|
55
|
-
return
|
|
136
|
+
return utils_1.aadGroup
|
|
56
137
|
.getGroupByDisplayName(args.options.ownerGroupName)
|
|
57
138
|
.then(group => group.id);
|
|
58
139
|
}
|
|
@@ -62,10 +143,16 @@ class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
|
62
143
|
option: '-t, --title <title>'
|
|
63
144
|
},
|
|
64
145
|
{
|
|
65
|
-
option:
|
|
146
|
+
option: '--ownerGroupId [ownerGroupId]'
|
|
66
147
|
},
|
|
67
148
|
{
|
|
68
|
-
option:
|
|
149
|
+
option: '--ownerGroupName [ownerGroupName]'
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
option: '--shareWithUserIds [shareWithUserIds]'
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
option: '--shareWithUserNames [shareWithUserNames]'
|
|
69
156
|
}
|
|
70
157
|
];
|
|
71
158
|
const parentOptions = super.options();
|
|
@@ -81,6 +168,12 @@ class PlannerPlanAddCommand extends GraphCommand_1.default {
|
|
|
81
168
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
82
169
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
83
170
|
}
|
|
171
|
+
if (args.options.shareWithUserIds && args.options.shareWithUserNames) {
|
|
172
|
+
return 'Specify either shareWithUserIds or shareWithUserNames but not both';
|
|
173
|
+
}
|
|
174
|
+
if (args.options.shareWithUserIds && !utils_1.validation.isValidGuidArray(args.options.shareWithUserIds.split(','))) {
|
|
175
|
+
return 'shareWithUserIds contains invalid GUID';
|
|
176
|
+
}
|
|
84
177
|
return true;
|
|
85
178
|
}
|
|
86
179
|
}
|
|
@@ -11,9 +11,6 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
11
11
|
get name() {
|
|
12
12
|
return commands_1.default.PLAN_GET;
|
|
13
13
|
}
|
|
14
|
-
alias() {
|
|
15
|
-
return [commands_1.default.PLAN_DETAILS_GET];
|
|
16
|
-
}
|
|
17
14
|
get description() {
|
|
18
15
|
return 'Get a Microsoft Planner plan';
|
|
19
16
|
}
|
|
@@ -31,7 +28,6 @@ class PlannerPlanGetCommand extends GraphCommand_1.default {
|
|
|
31
28
|
return ['id', 'title', 'createdDateTime', 'owner', '@odata.etag'];
|
|
32
29
|
}
|
|
33
30
|
commandAction(logger, args, cb) {
|
|
34
|
-
this.showDeprecationWarning(logger, commands_1.default.PLAN_DETAILS_GET, commands_1.default.PLAN_GET);
|
|
35
31
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
36
32
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
37
33
|
return;
|
|
@@ -23,7 +23,6 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
23
23
|
getTelemetryProperties(args) {
|
|
24
24
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
25
25
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
26
|
-
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
27
26
|
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
28
27
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
29
28
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
@@ -43,10 +42,6 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
43
42
|
return telemetryProps;
|
|
44
43
|
}
|
|
45
44
|
commandAction(logger, args, cb) {
|
|
46
|
-
if (args.options.planName) {
|
|
47
|
-
args.options.planTitle = args.options.planName;
|
|
48
|
-
this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
|
|
49
|
-
}
|
|
50
45
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
51
46
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
52
47
|
return;
|
|
@@ -227,7 +222,6 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
227
222
|
const options = [
|
|
228
223
|
{ option: '-t, --title <title>' },
|
|
229
224
|
{ option: '--planId [planId]' },
|
|
230
|
-
{ option: '--planName [planName]' },
|
|
231
225
|
{ option: '--planTitle [planTitle]' },
|
|
232
226
|
{ option: '--ownerGroupId [ownerGroupId]' },
|
|
233
227
|
{ option: '--ownerGroupName [ownerGroupName]' },
|
|
@@ -255,16 +249,16 @@ class PlannerTaskAddCommand extends GraphCommand_1.default {
|
|
|
255
249
|
return options.concat(parentOptions);
|
|
256
250
|
}
|
|
257
251
|
validate(args) {
|
|
258
|
-
if (!args.options.planId && !args.options.
|
|
252
|
+
if (!args.options.planId && !args.options.planTitle) {
|
|
259
253
|
return 'Specify either planId or planTitle';
|
|
260
254
|
}
|
|
261
|
-
if (args.options.planId &&
|
|
255
|
+
if (args.options.planId && args.options.planTitle) {
|
|
262
256
|
return 'Specify either planId or planTitle but not both';
|
|
263
257
|
}
|
|
264
|
-
if (
|
|
258
|
+
if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
265
259
|
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
266
260
|
}
|
|
267
|
-
if (
|
|
261
|
+
if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
268
262
|
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
269
263
|
}
|
|
270
264
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
@@ -11,9 +11,6 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
11
11
|
get name() {
|
|
12
12
|
return commands_1.default.TASK_GET;
|
|
13
13
|
}
|
|
14
|
-
alias() {
|
|
15
|
-
return [commands_1.default.TASK_DETAILS_GET];
|
|
16
|
-
}
|
|
17
14
|
get description() {
|
|
18
15
|
return 'Retrieve the specified planner task';
|
|
19
16
|
}
|
|
@@ -24,25 +21,15 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
24
21
|
telemetryProps.bucketId = typeof args.options.bucketId !== 'undefined';
|
|
25
22
|
telemetryProps.bucketName = typeof args.options.bucketName !== 'undefined';
|
|
26
23
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
27
|
-
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
28
24
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
29
25
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
30
26
|
return telemetryProps;
|
|
31
27
|
}
|
|
32
28
|
commandAction(logger, args, cb) {
|
|
33
|
-
this.showDeprecationWarning(logger, commands_1.default.TASK_DETAILS_GET, commands_1.default.TASK_GET);
|
|
34
|
-
if (args.options.planName) {
|
|
35
|
-
args.options.planTitle = args.options.planName;
|
|
36
|
-
this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
|
|
37
|
-
}
|
|
38
29
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
39
30
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
40
31
|
return;
|
|
41
32
|
}
|
|
42
|
-
// This check has been added to support task details get alias. Needs to be removed when deprecation is removed.
|
|
43
|
-
if (args.options.taskId) {
|
|
44
|
-
args.options.id = args.options.taskId;
|
|
45
|
-
}
|
|
46
33
|
this
|
|
47
34
|
.getTaskId(args.options)
|
|
48
35
|
.then(taskId => this.getTask(taskId))
|
|
@@ -157,13 +144,11 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
157
144
|
}
|
|
158
145
|
options() {
|
|
159
146
|
const options = [
|
|
160
|
-
{ option: '--taskId [taskId]' },
|
|
161
147
|
{ option: '-i, --id [id]' },
|
|
162
148
|
{ option: '-t, --title [title]' },
|
|
163
149
|
{ option: '--bucketId [bucketId]' },
|
|
164
150
|
{ option: '--bucketName [bucketName]' },
|
|
165
151
|
{ option: '--planId [planId]' },
|
|
166
|
-
{ option: '--planName [planName]' },
|
|
167
152
|
{ option: '--planTitle [planTitle]' },
|
|
168
153
|
{ option: '--ownerGroupId [ownerGroupId]' },
|
|
169
154
|
{ option: '--ownerGroupName [ownerGroupName]' }
|
|
@@ -178,16 +163,16 @@ class PlannerTaskGetCommand extends GraphCommand_1.default {
|
|
|
178
163
|
if (args.options.title && args.options.bucketId && args.options.bucketName) {
|
|
179
164
|
return 'Specify either bucketId or bucketName when using title but not both';
|
|
180
165
|
}
|
|
181
|
-
if (args.options.bucketName && !args.options.planId && !args.options.
|
|
166
|
+
if (args.options.bucketName && !args.options.planId && !args.options.planTitle) {
|
|
182
167
|
return 'Specify either planId or planTitle when using bucketName';
|
|
183
168
|
}
|
|
184
|
-
if (args.options.bucketName && args.options.planId &&
|
|
169
|
+
if (args.options.bucketName && args.options.planId && args.options.planTitle) {
|
|
185
170
|
return 'Specify either planId or planTitle when using bucketName but not both';
|
|
186
171
|
}
|
|
187
|
-
if (
|
|
172
|
+
if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
188
173
|
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
189
174
|
}
|
|
190
|
-
if (
|
|
175
|
+
if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
191
176
|
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
192
177
|
}
|
|
193
178
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
@@ -19,7 +19,6 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
19
19
|
telemetryProps.bucketId = typeof args.options.bucketId !== 'undefined';
|
|
20
20
|
telemetryProps.bucketName = typeof args.options.bucketName !== 'undefined';
|
|
21
21
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
22
|
-
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
23
22
|
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
24
23
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
25
24
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
@@ -29,10 +28,6 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
29
28
|
return ['id', 'title', 'startDateTime', 'dueDateTime', 'completedDateTime'];
|
|
30
29
|
}
|
|
31
30
|
commandAction(logger, args, cb) {
|
|
32
|
-
if (args.options.planName) {
|
|
33
|
-
args.options.planTitle = args.options.planName;
|
|
34
|
-
this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
|
|
35
|
-
}
|
|
36
31
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
37
32
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
38
33
|
return;
|
|
@@ -150,9 +145,6 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
150
145
|
{
|
|
151
146
|
option: '--planId [planId]'
|
|
152
147
|
},
|
|
153
|
-
{
|
|
154
|
-
option: '--planName [planName]'
|
|
155
|
-
},
|
|
156
148
|
{
|
|
157
149
|
option: '--planTitle [planTitle]'
|
|
158
150
|
},
|
|
@@ -170,16 +162,16 @@ class PlannerTaskListCommand extends GraphCommand_1.default {
|
|
|
170
162
|
if (args.options.bucketId && args.options.bucketName) {
|
|
171
163
|
return 'To retrieve tasks from a bucket, specify bucketId or bucketName, but not both';
|
|
172
164
|
}
|
|
173
|
-
if (args.options.bucketName && !args.options.planId && !args.options.
|
|
165
|
+
if (args.options.bucketName && !args.options.planId && !args.options.planTitle) {
|
|
174
166
|
return 'Specify either planId or planTitle when using bucketName';
|
|
175
167
|
}
|
|
176
|
-
if (args.options.planId &&
|
|
168
|
+
if (args.options.planId && args.options.planTitle) {
|
|
177
169
|
return 'Specify either planId or planTitle but not both';
|
|
178
170
|
}
|
|
179
|
-
if (
|
|
171
|
+
if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
180
172
|
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
181
173
|
}
|
|
182
|
-
if (
|
|
174
|
+
if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
183
175
|
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
184
176
|
}
|
|
185
177
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
@@ -23,7 +23,6 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
23
23
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
24
24
|
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
25
25
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
26
|
-
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
27
26
|
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
28
27
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
29
28
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
@@ -42,10 +41,6 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
42
41
|
return telemetryProps;
|
|
43
42
|
}
|
|
44
43
|
commandAction(logger, args, cb) {
|
|
45
|
-
if (args.options.planName) {
|
|
46
|
-
args.options.planTitle = args.options.planName;
|
|
47
|
-
this.warn(logger, `Option 'planName' is deprecated. Please use 'planTitle' instead`);
|
|
48
|
-
}
|
|
49
44
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
50
45
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
51
46
|
return;
|
|
@@ -269,7 +264,6 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
269
264
|
{ option: '-i, --id <id>' },
|
|
270
265
|
{ option: '-t, --title [title]' },
|
|
271
266
|
{ option: '--planId [planId]' },
|
|
272
|
-
{ option: '--planName [planName]' },
|
|
273
267
|
{ option: '--planTitle [planTitle]' },
|
|
274
268
|
{ option: '--ownerGroupId [ownerGroupId]' },
|
|
275
269
|
{ option: '--ownerGroupName [ownerGroupName]' },
|
|
@@ -293,16 +287,16 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
293
287
|
if (args.options.bucketId && args.options.bucketName) {
|
|
294
288
|
return 'Specify either bucketId or bucketName but not both';
|
|
295
289
|
}
|
|
296
|
-
if (args.options.bucketName && !args.options.planId && !args.options.
|
|
290
|
+
if (args.options.bucketName && !args.options.planId && !args.options.planTitle) {
|
|
297
291
|
return 'Specify either planId or planTitle when using bucketName';
|
|
298
292
|
}
|
|
299
|
-
if (args.options.bucketName && args.options.planId &&
|
|
293
|
+
if (args.options.bucketName && args.options.planId && args.options.planTitle) {
|
|
300
294
|
return 'Specify either planId or planTitle when using bucketName but not both';
|
|
301
295
|
}
|
|
302
|
-
if (
|
|
296
|
+
if (args.options.planTitle && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
303
297
|
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
304
298
|
}
|
|
305
|
-
if (
|
|
299
|
+
if (args.options.planTitle && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
306
300
|
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
307
301
|
}
|
|
308
302
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
@@ -8,7 +8,6 @@ exports.default = {
|
|
|
8
8
|
BUCKET_SET: `${prefix} bucket set`,
|
|
9
9
|
BUCKET_REMOVE: `${prefix} bucket remove`,
|
|
10
10
|
PLAN_ADD: `${prefix} plan add`,
|
|
11
|
-
PLAN_DETAILS_GET: `${prefix} plan details get`,
|
|
12
11
|
PLAN_GET: `${prefix} plan get`,
|
|
13
12
|
PLAN_LIST: `${prefix} plan list`,
|
|
14
13
|
PLAN_REMOVE: `${prefix} plan remove`,
|
|
@@ -16,7 +15,6 @@ exports.default = {
|
|
|
16
15
|
TASK_CHECKLISTITEM_ADD: `${prefix} task checklistitem add`,
|
|
17
16
|
TASK_CHECKLISTITEM_LIST: `${prefix} task checklistitem list`,
|
|
18
17
|
TASK_CHECKLISTITEM_REMOVE: `${prefix} task checklistitem remove`,
|
|
19
|
-
TASK_DETAILS_GET: `${prefix} task details get`,
|
|
20
18
|
TASK_GET: `${prefix} task get`,
|
|
21
19
|
TASK_LIST: `${prefix} task list`,
|
|
22
20
|
TASK_REFERENCE_ADD: `${prefix} task reference add`,
|
|
@@ -11,6 +11,11 @@ class SpoCustomActionGetCommand extends SpoCommand_1.default {
|
|
|
11
11
|
get description() {
|
|
12
12
|
return 'Gets details for the specified custom action';
|
|
13
13
|
}
|
|
14
|
+
optionSets() {
|
|
15
|
+
return [
|
|
16
|
+
['id', 'title']
|
|
17
|
+
];
|
|
18
|
+
}
|
|
14
19
|
getTelemetryProperties(args) {
|
|
15
20
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
21
|
telemetryProps.scope = args.options.scope || 'All';
|
|
@@ -56,14 +61,34 @@ class SpoCustomActionGetCommand extends SpoCommand_1.default {
|
|
|
56
61
|
}, (err) => this.handleRejectedPromise(err, logger, cb));
|
|
57
62
|
}
|
|
58
63
|
getCustomAction(options) {
|
|
64
|
+
const filter = options.id ?
|
|
65
|
+
`('${encodeURIComponent(options.id)}')` :
|
|
66
|
+
`?$filter=Title eq '${encodeURIComponent(options.title)}'`;
|
|
59
67
|
const requestOptions = {
|
|
60
|
-
url: `${options.url}/_api/${options.scope}/UserCustomActions
|
|
68
|
+
url: `${options.url}/_api/${options.scope}/UserCustomActions${filter}`,
|
|
61
69
|
headers: {
|
|
62
70
|
accept: 'application/json;odata=nometadata'
|
|
63
71
|
},
|
|
64
72
|
responseType: 'json'
|
|
65
73
|
};
|
|
66
|
-
|
|
74
|
+
if (options.id) {
|
|
75
|
+
return request_1.default
|
|
76
|
+
.get(requestOptions)
|
|
77
|
+
.then((res) => {
|
|
78
|
+
return Promise.resolve(res);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return request_1.default
|
|
82
|
+
.get(requestOptions)
|
|
83
|
+
.then((res) => {
|
|
84
|
+
if (res.value.length === 1) {
|
|
85
|
+
return Promise.resolve(res.value[0]);
|
|
86
|
+
}
|
|
87
|
+
if (res.value.length === 0) {
|
|
88
|
+
return Promise.reject(`No user custom action with title '${options.title}' found`);
|
|
89
|
+
}
|
|
90
|
+
return Promise.reject(`Multiple user custom actions with title '${options.title}' found. Please disambiguate using IDs: ${res.value.map(a => a.Id).join(', ')}`);
|
|
91
|
+
});
|
|
67
92
|
}
|
|
68
93
|
/**
|
|
69
94
|
* Get request with `web` scope is send first.
|
|
@@ -104,7 +129,10 @@ class SpoCustomActionGetCommand extends SpoCommand_1.default {
|
|
|
104
129
|
options() {
|
|
105
130
|
const options = [
|
|
106
131
|
{
|
|
107
|
-
option: '-i, --id
|
|
132
|
+
option: '-i, --id [id]'
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
option: '-t, --title [title]'
|
|
108
136
|
},
|
|
109
137
|
{
|
|
110
138
|
option: '-u, --url <url>'
|
|
@@ -118,7 +146,7 @@ class SpoCustomActionGetCommand extends SpoCommand_1.default {
|
|
|
118
146
|
return options.concat(parentOptions);
|
|
119
147
|
}
|
|
120
148
|
validate(args) {
|
|
121
|
-
if (utils_1.validation.isValidGuid(args.options.id) === false) {
|
|
149
|
+
if (args.options.id && utils_1.validation.isValidGuid(args.options.id) === false) {
|
|
122
150
|
return `${args.options.id} is not valid. Custom action id (Guid) expected.`;
|
|
123
151
|
}
|
|
124
152
|
if (utils_1.validation.isValidSharePointUrl(args.options.url) !== true) {
|
|
@@ -12,6 +12,11 @@ class SpoCustomActionRemoveCommand extends SpoCommand_1.default {
|
|
|
12
12
|
get description() {
|
|
13
13
|
return 'Removes the specified custom action';
|
|
14
14
|
}
|
|
15
|
+
optionSets() {
|
|
16
|
+
return [
|
|
17
|
+
['id', 'title']
|
|
18
|
+
];
|
|
19
|
+
}
|
|
15
20
|
getTelemetryProperties(args) {
|
|
16
21
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
17
22
|
telemetryProps.scope = args.options.scope || 'All';
|
|
@@ -54,16 +59,43 @@ class SpoCustomActionRemoveCommand extends SpoCommand_1.default {
|
|
|
54
59
|
});
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
getCustomActionId(options) {
|
|
63
|
+
if (options.id) {
|
|
64
|
+
return Promise.resolve(options.id);
|
|
65
|
+
}
|
|
66
|
+
const customActionRequestOptions = {
|
|
67
|
+
url: `${options.url}/_api/${options.scope}/UserCustomActions?$filter=Title eq '${encodeURIComponent(options.title)}'`,
|
|
60
68
|
headers: {
|
|
61
|
-
accept: 'application/json;odata=nometadata'
|
|
62
|
-
'X-HTTP-Method': 'DELETE'
|
|
69
|
+
accept: 'application/json;odata=nometadata'
|
|
63
70
|
},
|
|
64
71
|
responseType: 'json'
|
|
65
72
|
};
|
|
66
|
-
return request_1.default
|
|
73
|
+
return request_1.default
|
|
74
|
+
.get(customActionRequestOptions)
|
|
75
|
+
.then((res) => {
|
|
76
|
+
if (res.value.length === 1) {
|
|
77
|
+
return Promise.resolve(res.value[0].Id);
|
|
78
|
+
}
|
|
79
|
+
if (res.value.length === 0) {
|
|
80
|
+
return Promise.reject(`No user custom action with title '${options.title}' found`);
|
|
81
|
+
}
|
|
82
|
+
return Promise.reject(`Multiple user custom actions with title '${options.title}' found. Please disambiguate using IDs: ${res.value.map(a => a.Id).join(', ')}`);
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
removeScopedCustomAction(options) {
|
|
86
|
+
return this
|
|
87
|
+
.getCustomActionId(options)
|
|
88
|
+
.then((customActionId) => {
|
|
89
|
+
const requestOptions = {
|
|
90
|
+
url: `${options.url}/_api/${options.scope}/UserCustomActions('${encodeURIComponent(customActionId)}')')`,
|
|
91
|
+
headers: {
|
|
92
|
+
accept: 'application/json;odata=nometadata',
|
|
93
|
+
'X-HTTP-Method': 'DELETE'
|
|
94
|
+
},
|
|
95
|
+
responseType: 'json'
|
|
96
|
+
};
|
|
97
|
+
return request_1.default.post(requestOptions);
|
|
98
|
+
});
|
|
67
99
|
}
|
|
68
100
|
/**
|
|
69
101
|
* Remove request with `web` scope is send first.
|
|
@@ -95,7 +127,10 @@ class SpoCustomActionRemoveCommand extends SpoCommand_1.default {
|
|
|
95
127
|
options() {
|
|
96
128
|
const options = [
|
|
97
129
|
{
|
|
98
|
-
option: '-i, --id
|
|
130
|
+
option: '-i, --id [id]'
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
option: '-t, --title [title]'
|
|
99
134
|
},
|
|
100
135
|
{
|
|
101
136
|
option: '-u, --url <url>'
|
|
@@ -112,7 +147,7 @@ class SpoCustomActionRemoveCommand extends SpoCommand_1.default {
|
|
|
112
147
|
return options.concat(parentOptions);
|
|
113
148
|
}
|
|
114
149
|
validate(args) {
|
|
115
|
-
if (utils_1.validation.isValidGuid(args.options.id) === false) {
|
|
150
|
+
if (args.options.id && utils_1.validation.isValidGuid(args.options.id) === false) {
|
|
116
151
|
return `${args.options.id} is not valid. Custom action Id (GUID) expected.`;
|
|
117
152
|
}
|
|
118
153
|
if (utils_1.validation.isValidSharePointUrl(args.options.url) !== true) {
|
|
@@ -17,10 +17,19 @@ class SpoFieldGetCommand extends SpoCommand_1.default {
|
|
|
17
17
|
telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
|
|
18
18
|
telemetryProps.listUrl = typeof args.options.listUrl !== 'undefined';
|
|
19
19
|
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
20
|
-
telemetryProps.
|
|
20
|
+
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
21
21
|
return telemetryProps;
|
|
22
22
|
}
|
|
23
|
+
optionSets() {
|
|
24
|
+
return [
|
|
25
|
+
['id', 'title', 'fieldTitle']
|
|
26
|
+
];
|
|
27
|
+
}
|
|
23
28
|
commandAction(logger, args, cb) {
|
|
29
|
+
if (args.options.fieldTitle) {
|
|
30
|
+
args.options.title = args.options.fieldTitle;
|
|
31
|
+
this.warn(logger, `Option 'fieldTitle' is deprecated. Please use 'title' instead.`);
|
|
32
|
+
}
|
|
24
33
|
let listRestUrl = '';
|
|
25
34
|
if (args.options.listId) {
|
|
26
35
|
listRestUrl = `lists(guid'${utils_1.formatting.encodeQueryParameter(args.options.listId)}')/`;
|
|
@@ -37,7 +46,7 @@ class SpoFieldGetCommand extends SpoCommand_1.default {
|
|
|
37
46
|
fieldRestUrl = `/getbyid('${utils_1.formatting.encodeQueryParameter(args.options.id)}')`;
|
|
38
47
|
}
|
|
39
48
|
else {
|
|
40
|
-
fieldRestUrl = `/getbyinternalnameortitle('${utils_1.formatting.encodeQueryParameter(args.options.
|
|
49
|
+
fieldRestUrl = `/getbyinternalnameortitle('${utils_1.formatting.encodeQueryParameter(args.options.title)}')`;
|
|
41
50
|
}
|
|
42
51
|
const requestOptions = {
|
|
43
52
|
url: `${args.options.webUrl}/_api/web/${listRestUrl}fields${fieldRestUrl}`,
|
|
@@ -72,6 +81,9 @@ class SpoFieldGetCommand extends SpoCommand_1.default {
|
|
|
72
81
|
},
|
|
73
82
|
{
|
|
74
83
|
option: '--fieldTitle [fieldTitle]'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
option: '-t, --title [title]'
|
|
75
87
|
}
|
|
76
88
|
];
|
|
77
89
|
const parentOptions = super.options();
|
|
@@ -82,9 +94,6 @@ class SpoFieldGetCommand extends SpoCommand_1.default {
|
|
|
82
94
|
if (isValidSharePointUrl !== true) {
|
|
83
95
|
return isValidSharePointUrl;
|
|
84
96
|
}
|
|
85
|
-
if (!args.options.id && !args.options.fieldTitle) {
|
|
86
|
-
return 'Specify id or fieldTitle, one is required';
|
|
87
|
-
}
|
|
88
97
|
if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
|
|
89
98
|
return `${args.options.id} is not a valid GUID`;
|
|
90
99
|
}
|