@pnp/cli-microsoft365 6.0.0-beta.c32757e → 6.0.0-beta.e031afa
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 +17 -9
- package/dist/m365/planner/commands/bucket/bucket-get.js +19 -11
- package/dist/m365/planner/commands/bucket/bucket-list.js +17 -9
- package/dist/m365/planner/commands/bucket/bucket-remove.js +19 -11
- package/dist/m365/planner/commands/bucket/bucket-set.js +19 -11
- package/dist/m365/planner/commands/plan/plan-add.js +98 -5
- package/dist/m365/planner/commands/plan/plan-get.js +1 -5
- package/dist/m365/planner/commands/plan/plan-remove.js +1 -1
- package/dist/m365/planner/commands/task/task-add.js +15 -9
- package/dist/m365/planner/commands/task/task-get.js +14 -18
- package/dist/m365/planner/commands/task/task-list.js +19 -11
- package/dist/m365/planner/commands/task/task-remove.js +4 -19
- package/dist/m365/planner/commands/task/task-set.js +15 -9
- package/dist/m365/planner/commands.js +0 -2
- package/dist/m365/search/commands/externalconnection/externalconnection-get.js +69 -0
- package/dist/m365/search/commands.js +1 -0
- package/dist/m365/spo/base-permissions.js +9 -0
- 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-set.js +16 -9
- package/dist/m365/spo/commands/group/group-add.js +96 -0
- package/dist/m365/spo/commands/group/group-set.js +167 -0
- package/dist/m365/spo/commands/hubsite/hubsite-get.js +99 -13
- 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/roledefinition/RoleDefinition.js +3 -0
- package/dist/m365/spo/commands/roledefinition/RoleType.js +16 -0
- package/dist/m365/spo/commands/roledefinition/roledefinition-get.js +59 -0
- package/dist/m365/spo/commands/site/site-classic-list.js +1 -0
- package/dist/m365/spo/commands/site/site-classic-set.js +1 -0
- package/dist/m365/spo/commands/site/site-list.js +59 -17
- 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 -0
- package/dist/m365/teams/commands/team/team-archive.js +51 -15
- package/dist/m365/teams/commands/team/team-remove.js +47 -11
- package/dist/m365/teams/commands/team/team-unarchive.js +48 -12
- package/dist/utils/planner.js +6 -6
- 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 +9 -6
- package/docs/docs/cmd/planner/bucket/bucket-get.md +10 -7
- package/docs/docs/cmd/planner/bucket/bucket-list.md +8 -5
- package/docs/docs/cmd/planner/bucket/bucket-remove.md +8 -5
- package/docs/docs/cmd/planner/bucket/bucket-set.md +9 -6
- 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 +11 -8
- package/docs/docs/cmd/planner/task/task-get.md +17 -8
- package/docs/docs/cmd/planner/task/task-list.md +9 -6
- package/docs/docs/cmd/planner/task/task-set.md +9 -6
- package/docs/docs/cmd/search/externalconnection/externalconnection-get.md +33 -0
- 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-set.md +7 -4
- package/docs/docs/cmd/spo/group/group-add.md +51 -0
- package/docs/docs/cmd/spo/group/group-set.md +69 -0
- package/docs/docs/cmd/spo/hubsite/hubsite-get.md +39 -7
- 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/roledefinition/roledefinition-get.md +27 -0
- package/docs/docs/cmd/spo/site/site-classic-list.md +3 -0
- package/docs/docs/cmd/spo/site/site-classic-set.md +3 -0
- 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/team/team-archive.md +20 -5
- package/docs/docs/cmd/teams/team/team-remove.md +19 -5
- package/docs/docs/cmd/teams/team/team-unarchive.md +18 -4
- package/npm-shrinkwrap.json +173 -158
- package/package.json +13 -13
|
@@ -24,6 +24,7 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
24
24
|
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
25
25
|
telemetryProps.planId = typeof args.options.planId !== 'undefined';
|
|
26
26
|
telemetryProps.planName = typeof args.options.planName !== 'undefined';
|
|
27
|
+
telemetryProps.planTitle = typeof args.options.planTitle !== 'undefined';
|
|
27
28
|
telemetryProps.ownerGroupId = typeof args.options.ownerGroupId !== 'undefined';
|
|
28
29
|
telemetryProps.ownerGroupName = typeof args.options.ownerGroupName !== 'undefined';
|
|
29
30
|
telemetryProps.bucketId = typeof args.options.bucketId !== 'undefined';
|
|
@@ -41,6 +42,10 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
41
42
|
return telemetryProps;
|
|
42
43
|
}
|
|
43
44
|
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
|
+
}
|
|
44
49
|
if (utils_1.accessToken.isAppOnlyAccessToken(Auth_1.default.service.accessTokens[this.resource].accessToken)) {
|
|
45
50
|
this.handleError('This command does not support application permissions.', logger, cb);
|
|
46
51
|
return;
|
|
@@ -214,7 +219,7 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
214
219
|
}
|
|
215
220
|
return this
|
|
216
221
|
.getGroupId(options)
|
|
217
|
-
.then((groupId) => planner_1.planner.
|
|
222
|
+
.then((groupId) => planner_1.planner.getPlanByTitle(options.planTitle, groupId))
|
|
218
223
|
.then(plan => plan.id);
|
|
219
224
|
}
|
|
220
225
|
getGroupId(options) {
|
|
@@ -265,6 +270,7 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
265
270
|
{ option: '-t, --title [title]' },
|
|
266
271
|
{ option: '--planId [planId]' },
|
|
267
272
|
{ option: '--planName [planName]' },
|
|
273
|
+
{ option: '--planTitle [planTitle]' },
|
|
268
274
|
{ option: '--ownerGroupId [ownerGroupId]' },
|
|
269
275
|
{ option: '--ownerGroupName [ownerGroupName]' },
|
|
270
276
|
{ option: '--bucketId [bucketId]' },
|
|
@@ -287,17 +293,17 @@ class PlannerTaskSetCommand extends GraphCommand_1.default {
|
|
|
287
293
|
if (args.options.bucketId && args.options.bucketName) {
|
|
288
294
|
return 'Specify either bucketId or bucketName but not both';
|
|
289
295
|
}
|
|
290
|
-
if (args.options.bucketName && !args.options.planId && !args.options.planName) {
|
|
291
|
-
return 'Specify either planId or
|
|
296
|
+
if (args.options.bucketName && !args.options.planId && !args.options.planName && !args.options.planTitle) {
|
|
297
|
+
return 'Specify either planId or planTitle when using bucketName';
|
|
292
298
|
}
|
|
293
|
-
if (args.options.bucketName && args.options.planId && args.options.planName) {
|
|
294
|
-
return 'Specify either planId or
|
|
299
|
+
if (args.options.bucketName && args.options.planId && (args.options.planName || args.options.planTitle)) {
|
|
300
|
+
return 'Specify either planId or planTitle when using bucketName but not both';
|
|
295
301
|
}
|
|
296
|
-
if (args.options.planName && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
297
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
302
|
+
if ((args.options.planName || args.options.planTitle) && !args.options.ownerGroupId && !args.options.ownerGroupName) {
|
|
303
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle';
|
|
298
304
|
}
|
|
299
|
-
if (args.options.planName && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
300
|
-
return 'Specify either ownerGroupId or ownerGroupName when using
|
|
305
|
+
if ((args.options.planName || args.options.planTitle) && args.options.ownerGroupId && args.options.ownerGroupName) {
|
|
306
|
+
return 'Specify either ownerGroupId or ownerGroupName when using planTitle but not both';
|
|
301
307
|
}
|
|
302
308
|
if (args.options.ownerGroupId && !utils_1.validation.isValidGuid(args.options.ownerGroupId)) {
|
|
303
309
|
return `${args.options.ownerGroupId} is not a valid GUID`;
|
|
@@ -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`,
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
5
|
+
const commands_1 = require("../../commands");
|
|
6
|
+
class SearchExternalConnectionGetCommand extends GraphCommand_1.default {
|
|
7
|
+
get name() {
|
|
8
|
+
return commands_1.default.EXTERNALCONNECTION_GET;
|
|
9
|
+
}
|
|
10
|
+
get description() {
|
|
11
|
+
return 'Get a specific external connection for use in Microsoft Search';
|
|
12
|
+
}
|
|
13
|
+
getTelemetryProperties(args) {
|
|
14
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
15
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
16
|
+
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
17
|
+
return telemetryProps;
|
|
18
|
+
}
|
|
19
|
+
commandAction(logger, args, cb) {
|
|
20
|
+
let url = `${this.resource}/v1.0/external/connections`;
|
|
21
|
+
if (args.options.id) {
|
|
22
|
+
url += `/${encodeURIComponent(args.options.id)}`;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
url += `?$filter=name eq '${encodeURIComponent(args.options.name)}'`;
|
|
26
|
+
}
|
|
27
|
+
const requestOptions = {
|
|
28
|
+
url: url,
|
|
29
|
+
headers: {
|
|
30
|
+
accept: 'application/json;odata.metadata=none'
|
|
31
|
+
},
|
|
32
|
+
responseType: 'json'
|
|
33
|
+
};
|
|
34
|
+
request_1.default
|
|
35
|
+
.get(requestOptions)
|
|
36
|
+
.then((res) => {
|
|
37
|
+
if (args.options.name) {
|
|
38
|
+
if (res.value.length === 0) {
|
|
39
|
+
return Promise.reject(`External connection with name '${args.options.name}' not found`);
|
|
40
|
+
}
|
|
41
|
+
res = res.value[0];
|
|
42
|
+
}
|
|
43
|
+
return Promise.resolve(res);
|
|
44
|
+
})
|
|
45
|
+
.then(res => {
|
|
46
|
+
logger.log(res);
|
|
47
|
+
cb();
|
|
48
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
49
|
+
}
|
|
50
|
+
optionSets() {
|
|
51
|
+
return [
|
|
52
|
+
['id', 'name']
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
options() {
|
|
56
|
+
const options = [
|
|
57
|
+
{
|
|
58
|
+
option: '-i, --id [id]'
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
option: '-n, --name [name]'
|
|
62
|
+
}
|
|
63
|
+
];
|
|
64
|
+
const parentOptions = super.options();
|
|
65
|
+
return options.concat(parentOptions);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
module.exports = new SearchExternalConnectionGetCommand();
|
|
69
|
+
//# sourceMappingURL=externalconnection-get.js.map
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const prefix = 'search';
|
|
4
4
|
exports.default = {
|
|
5
5
|
EXTERNALCONNECTION_ADD: `${prefix} externalconnection add`,
|
|
6
|
+
EXTERNALCONNECTION_GET: `${prefix} externalconnection get`,
|
|
6
7
|
EXTERNALCONNECTION_LIST: `${prefix} externalconnection list`
|
|
7
8
|
};
|
|
8
9
|
//# sourceMappingURL=commands.js.map
|
|
@@ -22,6 +22,15 @@ class BasePermissions {
|
|
|
22
22
|
set low(value) {
|
|
23
23
|
this._low = value;
|
|
24
24
|
}
|
|
25
|
+
parse() {
|
|
26
|
+
const result = [];
|
|
27
|
+
for (const permissionKind in PermissionKind) {
|
|
28
|
+
if (this.has(PermissionKind[permissionKind])) {
|
|
29
|
+
result.push(permissionKind);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
25
34
|
has(perm) {
|
|
26
35
|
let hasPermission = false;
|
|
27
36
|
if (perm === PermissionKind.FullMask) {
|
|
@@ -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) {
|
|
@@ -16,6 +16,7 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
|
|
|
16
16
|
getTelemetryProperties(args) {
|
|
17
17
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
18
18
|
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
19
|
+
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
19
20
|
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
20
21
|
telemetryProps.listId = typeof args.options.listId !== 'undefined';
|
|
21
22
|
telemetryProps.listTitle = typeof args.options.listTitle !== 'undefined';
|
|
@@ -26,6 +27,9 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
|
|
|
26
27
|
return true;
|
|
27
28
|
}
|
|
28
29
|
commandAction(logger, args, cb) {
|
|
30
|
+
if (args.options.name) {
|
|
31
|
+
this.warn(logger, `Option 'name' is deprecated. Please use 'title' instead.`);
|
|
32
|
+
}
|
|
29
33
|
let requestDigest = '';
|
|
30
34
|
utils_1.spo
|
|
31
35
|
.getRequestDigest(args.options.webUrl)
|
|
@@ -61,7 +65,7 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
|
|
|
61
65
|
// retrieve column CSOM object id
|
|
62
66
|
const fieldQuery = args.options.id ?
|
|
63
67
|
`<Method Id="663" ParentId="7" Name="GetById"><Parameters><Parameter Type="Guid">${utils_1.formatting.escapeXml(args.options.id)}</Parameter></Parameters></Method>` :
|
|
64
|
-
`<Method Id="663" ParentId="7" Name="GetByInternalNameOrTitle"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(args.options.name)}</Parameter></Parameters></Method>`;
|
|
68
|
+
`<Method Id="663" ParentId="7" Name="GetByInternalNameOrTitle"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(args.options.name || args.options.title)}</Parameter></Parameters></Method>`;
|
|
65
69
|
const requestOptions = {
|
|
66
70
|
url: `${args.options.webUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
67
71
|
headers: {
|
|
@@ -105,6 +109,7 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
|
|
|
105
109
|
'listTitle',
|
|
106
110
|
'id',
|
|
107
111
|
'name',
|
|
112
|
+
'title',
|
|
108
113
|
'updateExistingLists',
|
|
109
114
|
'debug',
|
|
110
115
|
'verbose',
|
|
@@ -116,6 +121,11 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
|
|
|
116
121
|
}).join('');
|
|
117
122
|
return payload;
|
|
118
123
|
}
|
|
124
|
+
optionSets() {
|
|
125
|
+
return [
|
|
126
|
+
['id', 'title', 'name']
|
|
127
|
+
];
|
|
128
|
+
}
|
|
119
129
|
options() {
|
|
120
130
|
const options = [
|
|
121
131
|
{
|
|
@@ -128,10 +138,13 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
|
|
|
128
138
|
option: '--listTitle [listTitle]'
|
|
129
139
|
},
|
|
130
140
|
{
|
|
131
|
-
option: '-i
|
|
141
|
+
option: '-i, --id [id]'
|
|
132
142
|
},
|
|
133
143
|
{
|
|
134
|
-
option: '-n
|
|
144
|
+
option: '-n, --name [name]'
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
option: '-t, --title [title]'
|
|
135
148
|
},
|
|
136
149
|
{
|
|
137
150
|
option: '--updateExistingLists'
|
|
@@ -152,12 +165,6 @@ class SpoFieldSetCommand extends SpoCommand_1.default {
|
|
|
152
165
|
!utils_1.validation.isValidGuid(args.options.listId)) {
|
|
153
166
|
return `${args.options.listId} in option listId is not a valid GUID`;
|
|
154
167
|
}
|
|
155
|
-
if (!args.options.id && !args.options.name) {
|
|
156
|
-
return `Specify id or name`;
|
|
157
|
-
}
|
|
158
|
-
if (args.options.id && args.options.name) {
|
|
159
|
-
return `Specify viewId or viewTitle but not both`;
|
|
160
|
-
}
|
|
161
168
|
if (args.options.id &&
|
|
162
169
|
!utils_1.validation.isValidGuid(args.options.id)) {
|
|
163
170
|
return `${args.options.id} in option id is not a valid GUID`;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../../../../utils");
|
|
4
|
+
const request_1 = require("../../../../request");
|
|
5
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
6
|
+
const commands_1 = require("../../commands");
|
|
7
|
+
class SpoGroupAddCommand extends SpoCommand_1.default {
|
|
8
|
+
get name() {
|
|
9
|
+
return commands_1.default.GROUP_ADD;
|
|
10
|
+
}
|
|
11
|
+
get description() {
|
|
12
|
+
return 'Creates group in the specified site';
|
|
13
|
+
}
|
|
14
|
+
getTelemetryProperties(args) {
|
|
15
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
16
|
+
telemetryProps.description = typeof args.options.description !== 'undefined';
|
|
17
|
+
telemetryProps.allowMembersEditMembership = typeof args.options.allowMembersEditMembership !== 'undefined';
|
|
18
|
+
telemetryProps.onlyAllowMembersViewMembership = typeof args.options.onlyAllowMembersViewMembership !== 'undefined';
|
|
19
|
+
telemetryProps.allowRequestToJoinLeave = typeof args.options.allowRequestToJoinLeave !== 'undefined';
|
|
20
|
+
telemetryProps.autoAcceptRequestToJoinLeave = typeof args.options.autoAcceptRequestToJoinLeave !== 'undefined';
|
|
21
|
+
telemetryProps.requestToJoinLeaveEmailSetting = typeof args.options.requestToJoinLeaveEmailSetting !== 'undefined';
|
|
22
|
+
return telemetryProps;
|
|
23
|
+
}
|
|
24
|
+
commandAction(logger, args, cb) {
|
|
25
|
+
const requestOptions = {
|
|
26
|
+
url: `${args.options.webUrl}/_api/web/sitegroups`,
|
|
27
|
+
headers: {
|
|
28
|
+
accept: 'application/json;odata=nometadata'
|
|
29
|
+
},
|
|
30
|
+
responseType: 'json',
|
|
31
|
+
data: {
|
|
32
|
+
Title: args.options.name,
|
|
33
|
+
Description: args.options.description,
|
|
34
|
+
AllowMembersEditMembership: args.options.allowMembersEditMembership,
|
|
35
|
+
OnlyAllowMembersViewMembership: args.options.onlyAllowMembersViewMembership,
|
|
36
|
+
AllowRequestToJoinLeave: args.options.allowRequestToJoinLeave,
|
|
37
|
+
AutoAcceptRequestToJoinLeave: args.options.autoAcceptRequestToJoinLeave,
|
|
38
|
+
RequestToJoinLeaveEmailSetting: args.options.requestToJoinLeaveEmailSetting
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
request_1.default
|
|
42
|
+
.post(requestOptions)
|
|
43
|
+
.then((response) => {
|
|
44
|
+
logger.log(response);
|
|
45
|
+
cb();
|
|
46
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
47
|
+
}
|
|
48
|
+
options() {
|
|
49
|
+
const options = [
|
|
50
|
+
{
|
|
51
|
+
option: '-u, --webUrl <webUrl>'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
option: '-n, --name <name>'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
option: '--description [description]'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
option: '--allowMembersEditMembership [allowMembersEditMembership]'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
option: '--onlyAllowMembersViewMembership [onlyAllowMembersViewMembership]'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
option: '--allowRequestToJoinLeave [allowRequestToJoinLeave]'
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
option: '--autoAcceptRequestToJoinLeave [autoAcceptRequestToJoinLeave]'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
option: '--requestToJoinLeaveEmailSetting [requestToJoinLeaveEmailSetting]'
|
|
73
|
+
}
|
|
74
|
+
];
|
|
75
|
+
const parentOptions = super.options();
|
|
76
|
+
return options.concat(parentOptions);
|
|
77
|
+
}
|
|
78
|
+
validate(args) {
|
|
79
|
+
const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
80
|
+
if (isValidSharePointUrl !== true) {
|
|
81
|
+
return isValidSharePointUrl;
|
|
82
|
+
}
|
|
83
|
+
const booleanOptions = [
|
|
84
|
+
args.options.allowMembersEditMembership, args.options.onlyAllowMembersViewMembership,
|
|
85
|
+
args.options.allowRequestToJoinLeave, args.options.autoAcceptRequestToJoinLeave
|
|
86
|
+
];
|
|
87
|
+
for (const option of booleanOptions) {
|
|
88
|
+
if (typeof option !== 'undefined' && !utils_1.validation.isValidBoolean(option)) {
|
|
89
|
+
return `Value '${option}' is not a valid boolean`;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
module.exports = new SpoGroupAddCommand();
|
|
96
|
+
//# sourceMappingURL=group-add.js.map
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const AadUserGetCommand = require("../../../aad/commands/user/user-get");
|
|
4
|
+
const cli_1 = require("../../../../cli");
|
|
5
|
+
const utils_1 = require("../../../../utils");
|
|
6
|
+
const request_1 = require("../../../../request");
|
|
7
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
8
|
+
const commands_1 = require("../../commands");
|
|
9
|
+
class SpoGroupSetCommand extends SpoCommand_1.default {
|
|
10
|
+
get name() {
|
|
11
|
+
return commands_1.default.GROUP_SET;
|
|
12
|
+
}
|
|
13
|
+
get description() {
|
|
14
|
+
return 'Updates a group in the specified site';
|
|
15
|
+
}
|
|
16
|
+
getTelemetryProperties(args) {
|
|
17
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
18
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
19
|
+
telemetryProps.name = typeof args.options.name !== 'undefined';
|
|
20
|
+
telemetryProps.newName = typeof args.options.newName !== 'undefined';
|
|
21
|
+
telemetryProps.description = typeof args.options.description !== 'undefined';
|
|
22
|
+
telemetryProps.allowMembersEditMembership = typeof args.options.allowMembersEditMembership !== 'undefined';
|
|
23
|
+
telemetryProps.onlyAllowMembersViewMembership = typeof args.options.onlyAllowMembersViewMembership !== 'undefined';
|
|
24
|
+
telemetryProps.allowRequestToJoinLeave = typeof args.options.allowRequestToJoinLeave !== 'undefined';
|
|
25
|
+
telemetryProps.autoAcceptRequestToJoinLeave = typeof args.options.autoAcceptRequestToJoinLeave !== 'undefined';
|
|
26
|
+
telemetryProps.requestToJoinLeaveEmailSetting = typeof args.options.requestToJoinLeaveEmailSetting !== 'undefined';
|
|
27
|
+
telemetryProps.ownerEmail = typeof args.options.ownerEmail !== 'undefined';
|
|
28
|
+
telemetryProps.ownerUserName = typeof args.options.ownerUserName !== 'undefined';
|
|
29
|
+
return telemetryProps;
|
|
30
|
+
}
|
|
31
|
+
commandAction(logger, args, cb) {
|
|
32
|
+
const requestOptions = {
|
|
33
|
+
url: `${args.options.webUrl}/_api/web/sitegroups/${args.options.id ? `GetById(${args.options.id})` : `GetByName('${args.options.name}')`}`,
|
|
34
|
+
headers: {
|
|
35
|
+
accept: 'application/json;odata.metadata=none',
|
|
36
|
+
'content-type': 'application/json'
|
|
37
|
+
},
|
|
38
|
+
responseType: 'json',
|
|
39
|
+
data: {
|
|
40
|
+
Title: args.options.newName,
|
|
41
|
+
Description: args.options.description,
|
|
42
|
+
AllowMembersEditMembership: args.options.allowMembersEditMembership,
|
|
43
|
+
OnlyAllowMembersViewMembership: args.options.onlyAllowMembersViewMembership,
|
|
44
|
+
AllowRequestToJoinLeave: args.options.allowRequestToJoinLeave,
|
|
45
|
+
AutoAcceptRequestToJoinLeave: args.options.autoAcceptRequestToJoinLeave,
|
|
46
|
+
RequestToJoinLeaveEmailSetting: args.options.requestToJoinLeaveEmailSetting
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
request_1.default
|
|
50
|
+
.patch(requestOptions)
|
|
51
|
+
.then(() => this.setGroupOwner(args.options))
|
|
52
|
+
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
53
|
+
}
|
|
54
|
+
setGroupOwner(options) {
|
|
55
|
+
if (!options.ownerEmail && !options.ownerUserName) {
|
|
56
|
+
return Promise.resolve();
|
|
57
|
+
}
|
|
58
|
+
return this
|
|
59
|
+
.getOwnerId(options)
|
|
60
|
+
.then((ownerId) => {
|
|
61
|
+
const requestOptions = {
|
|
62
|
+
url: `${options.webUrl}/_api/web/sitegroups/${options.id ? `GetById(${options.id})` : `GetByName('${options.name}')`}/SetUserAsOwner(${ownerId})`,
|
|
63
|
+
headers: {
|
|
64
|
+
accept: 'application/json;odata.metadata=none',
|
|
65
|
+
'content-type': 'application/json'
|
|
66
|
+
},
|
|
67
|
+
responseType: 'json'
|
|
68
|
+
};
|
|
69
|
+
return request_1.default.post(requestOptions);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
getOwnerId(options) {
|
|
73
|
+
const cmdOptions = {
|
|
74
|
+
userName: options.ownerUserName,
|
|
75
|
+
email: options.ownerEmail,
|
|
76
|
+
output: 'json',
|
|
77
|
+
debug: options.debug,
|
|
78
|
+
verbose: options.verbose
|
|
79
|
+
};
|
|
80
|
+
return cli_1.Cli
|
|
81
|
+
.executeCommandWithOutput(AadUserGetCommand, { options: Object.assign(Object.assign({}, cmdOptions), { _: [] }) })
|
|
82
|
+
.then((output) => {
|
|
83
|
+
const getUserOutput = JSON.parse(output.stdout);
|
|
84
|
+
const requestOptions = {
|
|
85
|
+
url: `${options.webUrl}/_api/web/ensureUser('${getUserOutput.userPrincipalName}')?$select=Id`,
|
|
86
|
+
headers: {
|
|
87
|
+
accept: 'application/json',
|
|
88
|
+
'content-type': 'application/json'
|
|
89
|
+
},
|
|
90
|
+
responseType: 'json'
|
|
91
|
+
};
|
|
92
|
+
return request_1.default.post(requestOptions);
|
|
93
|
+
})
|
|
94
|
+
.then((response) => response.Id);
|
|
95
|
+
}
|
|
96
|
+
options() {
|
|
97
|
+
const options = [
|
|
98
|
+
{
|
|
99
|
+
option: '-u, --webUrl <webUrl>'
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
option: '-i, --id [id]'
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
option: '-n, --name [name]'
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
option: '--newName [newName]'
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
option: '--description [description]'
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
option: '--allowMembersEditMembership [allowMembersEditMembership]'
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
option: '--onlyAllowMembersViewMembership [onlyAllowMembersViewMembership]'
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
option: '--allowRequestToJoinLeave [allowRequestToJoinLeave]'
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
option: '--autoAcceptRequestToJoinLeave [autoAcceptRequestToJoinLeave]'
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
option: '--requestToJoinLeaveEmailSetting [requestToJoinLeaveEmailSetting]'
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
option: '--ownerEmail [ownerEmail]'
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
option: '--ownerUserName [ownerUserName]'
|
|
133
|
+
}
|
|
134
|
+
];
|
|
135
|
+
const parentOptions = super.options();
|
|
136
|
+
return options.concat(parentOptions);
|
|
137
|
+
}
|
|
138
|
+
optionSets() {
|
|
139
|
+
return [
|
|
140
|
+
['id', 'name']
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
validate(args) {
|
|
144
|
+
const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
145
|
+
if (isValidSharePointUrl !== true) {
|
|
146
|
+
return isValidSharePointUrl;
|
|
147
|
+
}
|
|
148
|
+
if (args.options.id && isNaN(args.options.id)) {
|
|
149
|
+
return `Specified id ${args.options.id} is not a number`;
|
|
150
|
+
}
|
|
151
|
+
if (args.options.ownerEmail && args.options.ownerUserName) {
|
|
152
|
+
return 'Specify either ownerEmail or ownerUserName but not both';
|
|
153
|
+
}
|
|
154
|
+
const booleanOptions = [
|
|
155
|
+
args.options.allowMembersEditMembership, args.options.onlyAllowMembersViewMembership,
|
|
156
|
+
args.options.allowRequestToJoinLeave, args.options.autoAcceptRequestToJoinLeave
|
|
157
|
+
];
|
|
158
|
+
for (const option of booleanOptions) {
|
|
159
|
+
if (typeof option !== 'undefined' && !utils_1.validation.isValidBoolean(option)) {
|
|
160
|
+
return `Value '${option}' is not a valid boolean`;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
module.exports = new SpoGroupSetCommand();
|
|
167
|
+
//# sourceMappingURL=group-set.js.map
|