@pnp/cli-microsoft365 6.0.0-beta.f73c4f8 → 6.0.0-beta.fe4e66d
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/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/plan/plan-add.js +98 -5
- 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 +38 -2
- package/dist/m365/spo/commands/listitem/listitem-get.js +9 -9
- package/dist/m365/spo/commands/listitem/listitem-list.js +5 -1
- package/dist/m365/spo/commands.js +2 -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/docs/docs/cmd/planner/plan/plan-add.md +18 -2
- package/docs/docs/cmd/planner/task/task-get.md +6 -0
- 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 +21 -0
- package/docs/docs/cmd/spo/listitem/listitem-get.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-list.md +8 -0
- 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/package.json +1 -1
package/dist/Auth.js
CHANGED
|
@@ -535,8 +535,8 @@ class Auth {
|
|
|
535
535
|
if (pos > -1) {
|
|
536
536
|
resource = resource.substr(0, pos);
|
|
537
537
|
}
|
|
538
|
-
if (resource === 'https://api.bap.microsoft.com') {
|
|
539
|
-
// api.bap.microsoft.com
|
|
538
|
+
if (resource === 'https://api.bap.microsoft.com' || resource === 'https://api.powerapps.com') {
|
|
539
|
+
// api.bap.microsoft.com and api.powerapps.com are not valid resources
|
|
540
540
|
// we need to use https://management.azure.com/ instead
|
|
541
541
|
resource = 'https://management.azure.com/';
|
|
542
542
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Command_1 = require("../../Command");
|
|
4
|
+
class PowerAppsCommand extends Command_1.default {
|
|
5
|
+
get resource() {
|
|
6
|
+
return 'https://api.powerapps.com';
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
exports.default = PowerAppsCommand;
|
|
10
|
+
//# sourceMappingURL=PowerAppsCommand.js.map
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const cli_1 = require("../../../../cli");
|
|
4
4
|
const request_1 = require("../../../../request");
|
|
5
5
|
const utils_1 = require("../../../../utils");
|
|
6
|
-
const
|
|
6
|
+
const PowerAppsCommand_1 = require("../../../base/PowerAppsCommand");
|
|
7
7
|
const commands_1 = require("../../commands");
|
|
8
8
|
const paAppListCommand = require("../app/app-list");
|
|
9
|
-
class PaAppGetCommand extends
|
|
9
|
+
class PaAppGetCommand extends PowerAppsCommand_1.default {
|
|
10
10
|
get name() {
|
|
11
11
|
return commands_1.default.APP_GET;
|
|
12
12
|
}
|
|
@@ -24,10 +24,8 @@ class PaAppGetCommand extends AzmgmtCommand_1.default {
|
|
|
24
24
|
}
|
|
25
25
|
commandAction(logger, args, cb) {
|
|
26
26
|
if (args.options.name) {
|
|
27
|
-
let requestUrl = '';
|
|
28
|
-
requestUrl = `${this.resource}providers/Microsoft.PowerApps/apps/${encodeURIComponent(args.options.name)}?api-version=2016-11-01`;
|
|
29
27
|
const requestOptions = {
|
|
30
|
-
url:
|
|
28
|
+
url: `${this.resource}/providers/Microsoft.PowerApps/apps/${encodeURIComponent(args.options.name)}?api-version=2016-11-01`,
|
|
31
29
|
headers: {
|
|
32
30
|
accept: 'application/json'
|
|
33
31
|
},
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const utils_1 = require("../../../../utils");
|
|
4
|
+
const PowerAppsCommand_1 = require("../../../base/PowerAppsCommand");
|
|
4
5
|
const commands_1 = require("../../commands");
|
|
5
|
-
class PaAppListCommand extends
|
|
6
|
+
class PaAppListCommand extends PowerAppsCommand_1.default {
|
|
6
7
|
get name() {
|
|
7
8
|
return commands_1.default.APP_LIST;
|
|
8
9
|
}
|
|
@@ -19,15 +20,15 @@ class PaAppListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCommand {
|
|
|
19
20
|
return telemetryProps;
|
|
20
21
|
}
|
|
21
22
|
commandAction(logger, args, cb) {
|
|
22
|
-
const url = `${this.resource}providers/Microsoft.PowerApps${args.options.asAdmin ? '/scopes/admin' : ''}${args.options.environment ? '/environments/' + encodeURIComponent(args.options.environment) : ''}/apps?api-version=2017-08-01`;
|
|
23
|
-
|
|
24
|
-
.getAllItems(url
|
|
25
|
-
.then(() => {
|
|
26
|
-
if (
|
|
27
|
-
|
|
23
|
+
const url = `${this.resource}/providers/Microsoft.PowerApps${args.options.asAdmin ? '/scopes/admin' : ''}${args.options.environment ? '/environments/' + encodeURIComponent(args.options.environment) : ''}/apps?api-version=2017-08-01`;
|
|
24
|
+
utils_1.odata
|
|
25
|
+
.getAllItems(url)
|
|
26
|
+
.then((apps) => {
|
|
27
|
+
if (apps.length > 0) {
|
|
28
|
+
apps.forEach(a => {
|
|
28
29
|
a.displayName = a.properties.displayName;
|
|
29
30
|
});
|
|
30
|
-
logger.log(
|
|
31
|
+
logger.log(apps);
|
|
31
32
|
}
|
|
32
33
|
else {
|
|
33
34
|
if (this.verbose) {
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const cli_1 = require("../../../../cli");
|
|
4
4
|
const request_1 = require("../../../../request");
|
|
5
5
|
const utils_1 = require("../../../../utils");
|
|
6
|
-
const
|
|
6
|
+
const PowerAppsCommand_1 = require("../../../base/PowerAppsCommand");
|
|
7
7
|
const commands_1 = require("../../commands");
|
|
8
|
-
class PaAppRemoveCommand extends
|
|
8
|
+
class PaAppRemoveCommand extends PowerAppsCommand_1.default {
|
|
9
9
|
get name() {
|
|
10
10
|
return commands_1.default.APP_REMOVE;
|
|
11
11
|
}
|
|
@@ -23,7 +23,7 @@ class PaAppRemoveCommand extends AzmgmtCommand_1.default {
|
|
|
23
23
|
}
|
|
24
24
|
const removePaApp = () => {
|
|
25
25
|
const requestOptions = {
|
|
26
|
-
url: `${this.resource}providers/Microsoft.PowerApps/apps/${encodeURIComponent(args.options.name)}?api-version=2017-08-01`,
|
|
26
|
+
url: `${this.resource}/providers/Microsoft.PowerApps/apps/${encodeURIComponent(args.options.name)}?api-version=2017-08-01`,
|
|
27
27
|
resolveWithFullResponse: true,
|
|
28
28
|
headers: {
|
|
29
29
|
accept: 'application/json'
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const fs = require("fs");
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const request_1 = require("../../../../request");
|
|
6
|
-
const
|
|
6
|
+
const PowerAppsCommand_1 = require("../../../base/PowerAppsCommand");
|
|
7
7
|
const commands_1 = require("../../../flow/commands");
|
|
8
8
|
const commands_2 = require("../../commands");
|
|
9
|
-
class PaConnectorExportCommand extends
|
|
9
|
+
class PaConnectorExportCommand extends PowerAppsCommand_1.default {
|
|
10
10
|
get name() {
|
|
11
11
|
return commands_2.default.CONNECTOR_EXPORT;
|
|
12
12
|
}
|
|
@@ -19,7 +19,7 @@ class PaConnectorExportCommand extends AzmgmtCommand_1.default {
|
|
|
19
19
|
commandAction(logger, args, cb) {
|
|
20
20
|
const outputFolder = path.resolve(args.options.outputFolder || '.', args.options.connector);
|
|
21
21
|
const requestOptions = {
|
|
22
|
-
url: `${this.resource}providers/Microsoft.PowerApps/apis/${encodeURIComponent(args.options.connector)}?api-version=2016-11-01&$filter=environment%20eq%20%27${encodeURIComponent(args.options.environment)}%27%20and%20IsCustomApi%20eq%20%27True%27`,
|
|
22
|
+
url: `${this.resource}/providers/Microsoft.PowerApps/apis/${encodeURIComponent(args.options.connector)}?api-version=2016-11-01&$filter=environment%20eq%20%27${encodeURIComponent(args.options.environment)}%27%20and%20IsCustomApi%20eq%20%27True%27`,
|
|
23
23
|
headers: {
|
|
24
24
|
accept: 'application/json'
|
|
25
25
|
},
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const utils_1 = require("../../../../utils");
|
|
4
|
+
const PowerAppsCommand_1 = require("../../../base/PowerAppsCommand");
|
|
4
5
|
const commands_1 = require("../../../flow/commands");
|
|
5
6
|
const commands_2 = require("../../commands");
|
|
6
|
-
class PaConnectorListCommand extends
|
|
7
|
+
class PaConnectorListCommand extends PowerAppsCommand_1.default {
|
|
7
8
|
get name() {
|
|
8
9
|
return commands_2.default.CONNECTOR_LIST;
|
|
9
10
|
}
|
|
@@ -17,15 +18,15 @@ class PaConnectorListCommand extends AzmgmtItemsListCommand_1.AzmgmtItemsListCom
|
|
|
17
18
|
return ['name', 'displayName'];
|
|
18
19
|
}
|
|
19
20
|
commandAction(logger, args, cb) {
|
|
20
|
-
const url = `${this.resource}providers/Microsoft.PowerApps/apis?api-version=2016-11-01&$filter=environment%20eq%20%27${encodeURIComponent(args.options.environment)}%27%20and%20IsCustomApi%20eq%20%27True%27`;
|
|
21
|
-
|
|
22
|
-
.getAllItems(url
|
|
23
|
-
.then(() => {
|
|
24
|
-
if (
|
|
25
|
-
|
|
21
|
+
const url = `${this.resource}/providers/Microsoft.PowerApps/apis?api-version=2016-11-01&$filter=environment%20eq%20%27${encodeURIComponent(args.options.environment)}%27%20and%20IsCustomApi%20eq%20%27True%27`;
|
|
22
|
+
utils_1.odata
|
|
23
|
+
.getAllItems(url)
|
|
24
|
+
.then((connectors) => {
|
|
25
|
+
if (connectors.length > 0) {
|
|
26
|
+
connectors.forEach(c => {
|
|
26
27
|
c.displayName = c.properties.displayName;
|
|
27
28
|
});
|
|
28
|
-
logger.log(
|
|
29
|
+
logger.log(connectors);
|
|
29
30
|
}
|
|
30
31
|
else {
|
|
31
32
|
if (this.verbose) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const request_1 = require("../../../../request");
|
|
4
|
-
const
|
|
4
|
+
const PowerAppsCommand_1 = require("../../../base/PowerAppsCommand");
|
|
5
5
|
const commands_1 = require("../../commands");
|
|
6
|
-
class PaEnvironmentGetCommand extends
|
|
6
|
+
class PaEnvironmentGetCommand extends PowerAppsCommand_1.default {
|
|
7
7
|
get name() {
|
|
8
8
|
return commands_1.default.ENVIRONMENT_GET;
|
|
9
9
|
}
|
|
@@ -18,7 +18,7 @@ class PaEnvironmentGetCommand extends AzmgmtCommand_1.default {
|
|
|
18
18
|
logger.logToStderr(`Retrieving information about Microsoft Power Apps environment ${args.options.name}...`);
|
|
19
19
|
}
|
|
20
20
|
const requestOptions = {
|
|
21
|
-
url: `${this.resource}providers/Microsoft.PowerApps/environments/${encodeURIComponent(args.options.name)}?api-version=2016-11-01`,
|
|
21
|
+
url: `${this.resource}/providers/Microsoft.PowerApps/environments/${encodeURIComponent(args.options.name)}?api-version=2016-11-01`,
|
|
22
22
|
headers: {
|
|
23
23
|
accept: 'application/json'
|
|
24
24
|
},
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const request_1 = require("../../../../request");
|
|
4
|
-
const
|
|
4
|
+
const PowerAppsCommand_1 = require("../../../base/PowerAppsCommand");
|
|
5
5
|
const commands_1 = require("../../commands");
|
|
6
|
-
class PaEnvironmentListCommand extends
|
|
6
|
+
class PaEnvironmentListCommand extends PowerAppsCommand_1.default {
|
|
7
7
|
get name() {
|
|
8
8
|
return commands_1.default.ENVIRONMENT_LIST;
|
|
9
9
|
}
|
|
@@ -18,7 +18,7 @@ class PaEnvironmentListCommand extends AzmgmtCommand_1.default {
|
|
|
18
18
|
logger.logToStderr(`Retrieving list of Microsoft Power Apps environments...`);
|
|
19
19
|
}
|
|
20
20
|
const requestOptions = {
|
|
21
|
-
url: `${this.resource}providers/Microsoft.PowerApps/environments?api-version=2017-08-01`,
|
|
21
|
+
url: `${this.resource}/providers/Microsoft.PowerApps/environments?api-version=2017-08-01`,
|
|
22
22
|
headers: {
|
|
23
23
|
accept: 'application/json'
|
|
24
24
|
},
|
|
@@ -27,7 +27,7 @@ class PaEnvironmentListCommand extends AzmgmtCommand_1.default {
|
|
|
27
27
|
request_1.default
|
|
28
28
|
.get(requestOptions)
|
|
29
29
|
.then((res) => {
|
|
30
|
-
if (res.value
|
|
30
|
+
if (res.value.length > 0) {
|
|
31
31
|
res.value.forEach(e => {
|
|
32
32
|
e.displayName = e.properties.displayName;
|
|
33
33
|
});
|
|
@@ -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
|
}
|
|
@@ -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
|