@pnp/cli-microsoft365 5.5.0-beta.aa71c26 → 5.5.0-beta.b940302
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/Command.js +22 -0
- package/dist/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +60 -9
- 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 -1
- package/dist/m365/planner/commands/plan/plan-remove.js +1 -1
- package/dist/m365/planner/commands/task/task-add.js +16 -16
- package/dist/m365/planner/commands/task/task-get.js +14 -9
- package/dist/m365/planner/commands/task/task-list.js +19 -11
- package/dist/m365/planner/commands/task/task-reference-add.js +1 -7
- package/dist/m365/planner/commands/task/task-reference-remove.js +11 -14
- package/dist/m365/planner/commands/task/task-remove.js +4 -19
- package/dist/m365/planner/commands/task/task-set.js +17 -23
- package/dist/m365/search/commands/externalconnection/externalconnection-get.js +69 -0
- package/dist/m365/search/commands.js +1 -0
- package/dist/m365/spfx/commands/project/project-upgrade/rules/FN015008_FILE_eslintrc_js.js +7 -0
- package/dist/m365/spfx/commands/project/project-upgrade/upgrade-1.15.0.js +6 -4
- 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/listitem/listitem-get.js +9 -9
- package/dist/m365/spo/commands/listitem/listitem-list.js +5 -1
- 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-list.js +59 -17
- 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/m365/tenant/commands/serviceannouncement/serviceannouncement-health-get.js +1 -9
- package/dist/utils/accessToken.js +18 -0
- package/dist/utils/planner.js +6 -6
- package/dist/utils/validation.js +5 -1
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-restore.md +21 -3
- package/docs/docs/cmd/aad/user/user-get.md +12 -0
- 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-remove.md +1 -1
- 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/listitem/listitem-get.md +11 -2
- package/docs/docs/cmd/spo/listitem/listitem-list.md +8 -0
- 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-list.md +19 -7
- 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
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const cli_1 = require("../../../../cli");
|
|
3
4
|
const request_1 = require("../../../../request");
|
|
4
5
|
const utils_1 = require("../../../../utils");
|
|
5
6
|
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
6
7
|
const commands_1 = require("../../commands");
|
|
8
|
+
const SpoListItemListCommand = require("../listitem/listitem-list");
|
|
7
9
|
class SpoHubSiteGetCommand extends SpoCommand_1.default {
|
|
8
10
|
get name() {
|
|
9
11
|
return commands_1.default.HUBSITE_GET;
|
|
@@ -11,37 +13,121 @@ class SpoHubSiteGetCommand extends SpoCommand_1.default {
|
|
|
11
13
|
get description() {
|
|
12
14
|
return 'Gets information about the specified hub site';
|
|
13
15
|
}
|
|
16
|
+
getTelemetryProperties(args) {
|
|
17
|
+
const telemetryProps = super.getTelemetryProperties(args);
|
|
18
|
+
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
19
|
+
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
20
|
+
telemetryProps.url = typeof args.options.url !== 'undefined';
|
|
21
|
+
telemetryProps.includeAssociatedSites = args.options.includeAssociatedSites === true;
|
|
22
|
+
return telemetryProps;
|
|
23
|
+
}
|
|
24
|
+
getAssociatedSites(spoAdminUrl, hubSiteId, logger, args) {
|
|
25
|
+
const options = {
|
|
26
|
+
output: 'json',
|
|
27
|
+
debug: args.options.debug,
|
|
28
|
+
verbose: args.options.verbose,
|
|
29
|
+
listTitle: 'DO_NOT_DELETE_SPLIST_TENANTADMIN_AGGREGATED_SITECOLLECTIONS',
|
|
30
|
+
webUrl: spoAdminUrl,
|
|
31
|
+
filter: `HubSiteId eq '${hubSiteId}'`,
|
|
32
|
+
fields: 'Title,SiteUrl,SiteId'
|
|
33
|
+
};
|
|
34
|
+
return cli_1.Cli
|
|
35
|
+
.executeCommandWithOutput(SpoListItemListCommand, { options: Object.assign(Object.assign({}, options), { _: [] }) });
|
|
36
|
+
}
|
|
14
37
|
commandAction(logger, args, cb) {
|
|
38
|
+
let hubSite;
|
|
15
39
|
utils_1.spo
|
|
16
40
|
.getSpoUrl(logger, this.debug)
|
|
17
41
|
.then((spoUrl) => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
return request_1.default.get(requestOptions);
|
|
42
|
+
if (args.options.id) {
|
|
43
|
+
return this.getHubSiteById(spoUrl, args.options);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return this.getHubSite(spoUrl, args.options);
|
|
47
|
+
}
|
|
26
48
|
})
|
|
27
49
|
.then((res) => {
|
|
28
|
-
|
|
50
|
+
hubSite = res;
|
|
51
|
+
if (args.options.includeAssociatedSites && (args.options.output && args.options.output !== 'json')) {
|
|
52
|
+
throw Error('includeAssociatedSites option is only allowed with json output mode');
|
|
53
|
+
}
|
|
54
|
+
if (args.options.includeAssociatedSites !== true || args.options.output && args.options.output !== 'json') {
|
|
55
|
+
return Promise.resolve();
|
|
56
|
+
}
|
|
57
|
+
return utils_1.spo
|
|
58
|
+
.getSpoAdminUrl(logger, this.debug)
|
|
59
|
+
.then((spoAdminUrl) => {
|
|
60
|
+
return this.getAssociatedSites(spoAdminUrl, hubSite.SiteId, logger, args);
|
|
61
|
+
});
|
|
62
|
+
})
|
|
63
|
+
.then((associatedSitesCommandOutput) => {
|
|
64
|
+
if (args.options.includeAssociatedSites) {
|
|
65
|
+
const associatedSites = JSON.parse(associatedSitesCommandOutput.stdout);
|
|
66
|
+
hubSite.AssociatedSites = associatedSites.filter(s => s.SiteId !== hubSite.SiteId);
|
|
67
|
+
}
|
|
68
|
+
logger.log(hubSite);
|
|
29
69
|
cb();
|
|
30
70
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
31
71
|
}
|
|
72
|
+
getHubSiteById(spoUrl, options) {
|
|
73
|
+
const requestOptions = {
|
|
74
|
+
url: `${spoUrl}/_api/hubsites/getbyid('${options.id}')`,
|
|
75
|
+
headers: {
|
|
76
|
+
accept: 'application/json;odata=nometadata'
|
|
77
|
+
},
|
|
78
|
+
responseType: 'json'
|
|
79
|
+
};
|
|
80
|
+
return request_1.default.get(requestOptions);
|
|
81
|
+
}
|
|
82
|
+
getHubSite(spoUrl, options) {
|
|
83
|
+
const requestOptions = {
|
|
84
|
+
url: `${spoUrl}/_api/hubsites`,
|
|
85
|
+
headers: {
|
|
86
|
+
accept: 'application/json;odata=nometadata'
|
|
87
|
+
},
|
|
88
|
+
responseType: 'json'
|
|
89
|
+
};
|
|
90
|
+
return request_1.default
|
|
91
|
+
.get(requestOptions)
|
|
92
|
+
.then((response) => {
|
|
93
|
+
let hubSites = response.value;
|
|
94
|
+
if (options.title) {
|
|
95
|
+
hubSites = hubSites.filter(site => site.Title.toLocaleLowerCase() === options.title.toLocaleLowerCase());
|
|
96
|
+
}
|
|
97
|
+
else if (options.url) {
|
|
98
|
+
hubSites = hubSites.filter(site => site.SiteUrl.toLocaleLowerCase() === options.url.toLocaleLowerCase());
|
|
99
|
+
}
|
|
100
|
+
if (hubSites.length === 0) {
|
|
101
|
+
return Promise.reject(`The specified hub site ${options.title || options.url} does not exist`);
|
|
102
|
+
}
|
|
103
|
+
if (hubSites.length > 1) {
|
|
104
|
+
return Promise.reject(`Multiple hub sites with ${options.title || options.url} found. Please disambiguate: ${hubSites.map(site => site.SiteUrl).join(', ')}`);
|
|
105
|
+
}
|
|
106
|
+
return hubSites[0];
|
|
107
|
+
});
|
|
108
|
+
}
|
|
32
109
|
options() {
|
|
33
110
|
const options = [
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
}
|
|
111
|
+
{ option: '-i, --id [id]' },
|
|
112
|
+
{ option: '-t, --title [title]' },
|
|
113
|
+
{ option: '-u, --url [url]' },
|
|
114
|
+
{ option: '--includeAssociatedSites' }
|
|
37
115
|
];
|
|
38
116
|
const parentOptions = super.options();
|
|
39
117
|
return options.concat(parentOptions);
|
|
40
118
|
}
|
|
119
|
+
optionSets() {
|
|
120
|
+
return [
|
|
121
|
+
['id', 'title', 'url']
|
|
122
|
+
];
|
|
123
|
+
}
|
|
41
124
|
validate(args) {
|
|
42
|
-
if (!utils_1.validation.isValidGuid(args.options.id)) {
|
|
125
|
+
if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
|
|
43
126
|
return `${args.options.id} is not a valid GUID`;
|
|
44
127
|
}
|
|
128
|
+
if (args.options.url) {
|
|
129
|
+
return utils_1.validation.isValidSharePointUrl(args.options.url);
|
|
130
|
+
}
|
|
45
131
|
return true;
|
|
46
132
|
}
|
|
47
133
|
}
|
|
@@ -24,15 +24,15 @@ class SpoListItemGetCommand extends SpoCommand_1.default {
|
|
|
24
24
|
const listIdArgument = args.options.listId || '';
|
|
25
25
|
const listTitleArgument = args.options.listTitle || '';
|
|
26
26
|
const listRestUrl = (args.options.listId ?
|
|
27
|
-
`${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(listIdArgument)}')`
|
|
28
|
-
|
|
29
|
-
const propertiesSelect = args.options.properties ?
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
`${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(listIdArgument)}')` :
|
|
28
|
+
`${args.options.webUrl}/_api/web/lists/getByTitle('${utils_1.formatting.encodeQueryParameter(listTitleArgument)}')`);
|
|
29
|
+
const propertiesSelect = args.options.properties ? args.options.properties.split(',') : [];
|
|
30
|
+
const propertiesWithSlash = propertiesSelect.filter(item => item.includes('/'));
|
|
31
|
+
const propertiesToExpand = propertiesWithSlash.map(e => e.split('/')[0]);
|
|
32
|
+
const expandPropertiesArray = propertiesToExpand.filter((item, pos) => propertiesToExpand.indexOf(item) === pos);
|
|
33
|
+
const fieldExpand = expandPropertiesArray.length > 0 ? `&$expand=${expandPropertiesArray.join(",")}` : ``;
|
|
34
34
|
const requestOptions = {
|
|
35
|
-
url: `${listRestUrl}/items(${args.options.id})
|
|
35
|
+
url: `${listRestUrl}/items(${args.options.id})?$select=${encodeURIComponent(propertiesSelect.join(","))}${fieldExpand}`,
|
|
36
36
|
headers: {
|
|
37
37
|
'accept': 'application/json;odata=nometadata'
|
|
38
38
|
},
|
|
@@ -41,7 +41,7 @@ class SpoListItemGetCommand extends SpoCommand_1.default {
|
|
|
41
41
|
request_1.default
|
|
42
42
|
.get(requestOptions)
|
|
43
43
|
.then((response) => {
|
|
44
|
-
delete response[
|
|
44
|
+
delete response['ID'];
|
|
45
45
|
logger.log(response);
|
|
46
46
|
cb();
|
|
47
47
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
@@ -36,6 +36,9 @@ class SpoListItemListCommand extends SpoCommand_1.default {
|
|
|
36
36
|
let formDigestValue = '';
|
|
37
37
|
const fieldsArray = args.options.fields ? args.options.fields.split(",")
|
|
38
38
|
: (!args.options.output || args.options.output === "text") ? ["Title", "Id"] : [];
|
|
39
|
+
const fieldsWithSlash = fieldsArray.filter(item => item.includes('/'));
|
|
40
|
+
const fieldsToExpand = fieldsWithSlash.map(e => e.split('/')[0]);
|
|
41
|
+
const expandFieldsArray = fieldsToExpand.filter((item, pos) => fieldsToExpand.indexOf(item) === pos);
|
|
39
42
|
const listRestUrl = listIdArgument ?
|
|
40
43
|
`${args.options.webUrl}/_api/web/lists(guid'${utils_1.formatting.encodeQueryParameter(listIdArgument)}')`
|
|
41
44
|
: `${args.options.webUrl}/_api/web/lists/getByTitle('${utils_1.formatting.encodeQueryParameter(listTitleArgument)}')`;
|
|
@@ -75,8 +78,9 @@ class SpoListItemListCommand extends SpoCommand_1.default {
|
|
|
75
78
|
const skipToken = (args.options.pageNumber && Number(args.options.pageNumber) > 0 && skipTokenId > 0) ? `$skiptoken=Paged=TRUE%26p_ID=${res.value[res.value.length - 1].Id}` : ``;
|
|
76
79
|
const rowLimit = args.options.pageSize ? `$top=${args.options.pageSize}` : ``;
|
|
77
80
|
const filter = args.options.filter ? `$filter=${encodeURIComponent(args.options.filter)}` : ``;
|
|
81
|
+
const fieldExpand = expandFieldsArray.length > 0 ? `&$expand=${expandFieldsArray.join(",")}` : ``;
|
|
78
82
|
const fieldSelect = fieldsArray.length > 0 ?
|
|
79
|
-
`?$select=${encodeURIComponent(fieldsArray.join(","))}&${rowLimit}&${skipToken}&${filter}` :
|
|
83
|
+
`?$select=${encodeURIComponent(fieldsArray.join(","))}${fieldExpand}&${rowLimit}&${skipToken}&${filter}` :
|
|
80
84
|
`?${rowLimit}&${skipToken}&${filter}`;
|
|
81
85
|
const requestBody = args.options.camlQuery ?
|
|
82
86
|
{
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RoleType = void 0;
|
|
4
|
+
var RoleType;
|
|
5
|
+
(function (RoleType) {
|
|
6
|
+
RoleType[RoleType["None"] = 0] = "None";
|
|
7
|
+
RoleType[RoleType["Guest"] = 1] = "Guest";
|
|
8
|
+
RoleType[RoleType["Reader"] = 2] = "Reader";
|
|
9
|
+
RoleType[RoleType["Contributor"] = 3] = "Contributor";
|
|
10
|
+
RoleType[RoleType["WebDesigner"] = 4] = "WebDesigner";
|
|
11
|
+
RoleType[RoleType["Administrator"] = 5] = "Administrator";
|
|
12
|
+
RoleType[RoleType["Editor"] = 6] = "Editor";
|
|
13
|
+
RoleType[RoleType["Reviewer"] = 7] = "Reviewer";
|
|
14
|
+
RoleType[RoleType["System"] = 8] = "System";
|
|
15
|
+
})(RoleType = exports.RoleType || (exports.RoleType = {}));
|
|
16
|
+
//# sourceMappingURL=RoleType.js.map
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const request_1 = require("../../../../request");
|
|
4
|
+
const utils_1 = require("../../../../utils");
|
|
5
|
+
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
6
|
+
const base_permissions_1 = require("../../base-permissions");
|
|
7
|
+
const commands_1 = require("../../commands");
|
|
8
|
+
const RoleType_1 = require("./RoleType");
|
|
9
|
+
class SpoRoleDefinitionGetCommand extends SpoCommand_1.default {
|
|
10
|
+
get name() {
|
|
11
|
+
return commands_1.default.ROLEDEFINITION_GET;
|
|
12
|
+
}
|
|
13
|
+
get description() {
|
|
14
|
+
return 'Gets specified role definition from web by id';
|
|
15
|
+
}
|
|
16
|
+
commandAction(logger, args, cb) {
|
|
17
|
+
if (this.verbose) {
|
|
18
|
+
logger.logToStderr(`Getting role definition from ${args.options.webUrl}...`);
|
|
19
|
+
}
|
|
20
|
+
const requestOptions = {
|
|
21
|
+
url: `${args.options.webUrl}/_api/web/roledefinitions(${args.options.id})`,
|
|
22
|
+
headers: {
|
|
23
|
+
'accept': 'application/json;odata=nometadata'
|
|
24
|
+
},
|
|
25
|
+
responseType: 'json'
|
|
26
|
+
};
|
|
27
|
+
request_1.default
|
|
28
|
+
.get(requestOptions)
|
|
29
|
+
.then((response) => {
|
|
30
|
+
const permissions = new base_permissions_1.BasePermissions();
|
|
31
|
+
permissions.high = response.BasePermissions.High;
|
|
32
|
+
permissions.low = response.BasePermissions.Low;
|
|
33
|
+
response.BasePermissionsValue = permissions.parse();
|
|
34
|
+
response.RoleTypeKindValue = RoleType_1.RoleType[response.RoleTypeKind];
|
|
35
|
+
logger.log(response);
|
|
36
|
+
cb();
|
|
37
|
+
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
38
|
+
}
|
|
39
|
+
options() {
|
|
40
|
+
const options = [
|
|
41
|
+
{
|
|
42
|
+
option: '-u, --webUrl <webUrl>'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
option: '-i, --id <id>'
|
|
46
|
+
}
|
|
47
|
+
];
|
|
48
|
+
const parentOptions = super.options();
|
|
49
|
+
return options.concat(parentOptions);
|
|
50
|
+
}
|
|
51
|
+
validate(args) {
|
|
52
|
+
if (isNaN(args.options.id)) {
|
|
53
|
+
return `${args.options.id} is not a number`;
|
|
54
|
+
}
|
|
55
|
+
return utils_1.validation.isValidSharePointUrl(args.options.webUrl);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
module.exports = new SpoRoleDefinitionGetCommand();
|
|
59
|
+
//# sourceMappingURL=roledefinition-get.js.map
|
|
@@ -23,6 +23,7 @@ class SpoSiteClassicListCommand extends SpoCommand_1.default {
|
|
|
23
23
|
return ['Title', 'Url'];
|
|
24
24
|
}
|
|
25
25
|
commandAction(logger, args, cb) {
|
|
26
|
+
this.showDeprecationWarning(logger, commands_1.default.SITE_CLASSIC_LIST, commands_1.default.SITE_LIST);
|
|
26
27
|
const webTemplate = args.options.webTemplate || '';
|
|
27
28
|
const includeOneDriveSites = args.options.includeOneDriveSites || false;
|
|
28
29
|
const personalSite = includeOneDriveSites === false ? '0' : '1';
|
|
@@ -10,22 +10,25 @@ class SpoSiteListCommand extends SpoCommand_1.default {
|
|
|
10
10
|
return commands_1.default.SITE_LIST;
|
|
11
11
|
}
|
|
12
12
|
get description() {
|
|
13
|
-
return 'Lists
|
|
13
|
+
return 'Lists sites of the given type';
|
|
14
14
|
}
|
|
15
15
|
getTelemetryProperties(args) {
|
|
16
16
|
const telemetryProps = super.getTelemetryProperties(args);
|
|
17
|
-
telemetryProps.
|
|
17
|
+
telemetryProps.webTemplate = args.options.webTemplate;
|
|
18
18
|
telemetryProps.filter = (!(!args.options.filter)).toString();
|
|
19
|
-
telemetryProps.
|
|
19
|
+
telemetryProps.includeOneDriveSites = typeof args.options.includeOneDriveSites !== 'undefined';
|
|
20
|
+
telemetryProps.deleted = typeof args.options.deleted !== 'undefined';
|
|
21
|
+
telemetryProps.siteType = args.options.type || 'TeamSite';
|
|
20
22
|
return telemetryProps;
|
|
21
23
|
}
|
|
22
24
|
defaultProperties() {
|
|
23
25
|
return ['Title', 'Url'];
|
|
24
26
|
}
|
|
25
27
|
commandAction(logger, args, cb) {
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
28
|
+
const webTemplate = this.getWebTemplateId(args.options);
|
|
29
|
+
const includeOneDriveSites = args.options.includeOneDriveSites || false;
|
|
30
|
+
const personalSite = includeOneDriveSites === false ? '0' : '1';
|
|
31
|
+
let spoAdminUrl = '';
|
|
29
32
|
utils_1.spo
|
|
30
33
|
.getSpoAdminUrl(logger, this.debug)
|
|
31
34
|
.then((_spoAdminUrl) => {
|
|
@@ -34,19 +37,19 @@ class SpoSiteListCommand extends SpoCommand_1.default {
|
|
|
34
37
|
logger.logToStderr(`Retrieving list of site collections...`);
|
|
35
38
|
}
|
|
36
39
|
this.allSites = [];
|
|
37
|
-
return this.getAllSites(spoAdminUrl, utils_1.formatting.escapeXml(args.options.filter || ''), '0', webTemplate, undefined, args.options.deleted, logger);
|
|
40
|
+
return this.getAllSites(spoAdminUrl, utils_1.formatting.escapeXml(args.options.filter || ''), '0', personalSite, webTemplate, undefined, args.options.deleted, logger);
|
|
38
41
|
})
|
|
39
42
|
.then(_ => {
|
|
40
43
|
logger.log(this.allSites);
|
|
41
44
|
cb();
|
|
42
45
|
}, (err) => this.handleRejectedPromise(err, logger, cb));
|
|
43
46
|
}
|
|
44
|
-
getAllSites(spoAdminUrl, filter, startIndex, webTemplate, formDigest, deleted, logger) {
|
|
47
|
+
getAllSites(spoAdminUrl, filter, startIndex, personalSite, webTemplate, formDigest, deleted, logger) {
|
|
45
48
|
return new Promise((resolve, reject) => {
|
|
46
49
|
utils_1.spo
|
|
47
50
|
.ensureFormDigest(spoAdminUrl, logger, formDigest, this.debug)
|
|
48
51
|
.then((res) => {
|
|
49
|
-
let requestBody = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="2" ObjectPathId="1" /><ObjectPath Id="4" ObjectPathId="3" /><Query Id="5" ObjectPathId="3"><Query SelectAllProperties="true"><Properties /></Query><ChildItemQuery SelectAllProperties="true"><Properties /></ChildItemQuery></Query></Actions><ObjectPaths><Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="3" ParentId="1" Name="GetSitePropertiesFromSharePointByFilters"><Parameters><Parameter TypeId="{b92aeee2-c92c-4b67-abcc-024e471bc140}"><Property Name="Filter" Type="String">${filter}</Property><Property Name="IncludeDetail" Type="Boolean">false</Property><Property Name="IncludePersonalSite" Type="Enum"
|
|
52
|
+
let requestBody = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="2" ObjectPathId="1" /><ObjectPath Id="4" ObjectPathId="3" /><Query Id="5" ObjectPathId="3"><Query SelectAllProperties="true"><Properties /></Query><ChildItemQuery SelectAllProperties="true"><Properties /></ChildItemQuery></Query></Actions><ObjectPaths><Constructor Id="1" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="3" ParentId="1" Name="GetSitePropertiesFromSharePointByFilters"><Parameters><Parameter TypeId="{b92aeee2-c92c-4b67-abcc-024e471bc140}"><Property Name="Filter" Type="String">${filter}</Property><Property Name="IncludeDetail" Type="Boolean">false</Property><Property Name="IncludePersonalSite" Type="Enum">${personalSite}</Property><Property Name="StartIndex" Type="String">${startIndex}</Property><Property Name="Template" Type="String">${webTemplate}</Property></Parameter></Parameters></Method></ObjectPaths></Request>`;
|
|
50
53
|
if (deleted) {
|
|
51
54
|
requestBody = `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config_1.default.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="4" ObjectPathId="3" /><ObjectPath Id="6" ObjectPathId="5" /><Query Id="7" ObjectPathId="5"><Query SelectAllProperties="true"><Properties><Property Name="NextStartIndexFromSharePoint" ScalarProperty="true" /></Properties></Query><ChildItemQuery SelectAllProperties="true"><Properties /></ChildItemQuery></Query></Actions><ObjectPaths><Constructor Id="3" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="5" ParentId="3" Name="GetDeletedSitePropertiesFromSharePoint"><Parameters><Parameter Type="String">${startIndex}</Parameter></Parameters></Method></ObjectPaths></Request>`;
|
|
52
55
|
}
|
|
@@ -71,7 +74,7 @@ class SpoSiteListCommand extends SpoCommand_1.default {
|
|
|
71
74
|
this.allSites.push(...sites._Child_Items_);
|
|
72
75
|
if (sites.NextStartIndexFromSharePoint) {
|
|
73
76
|
this
|
|
74
|
-
.getAllSites(spoAdminUrl, filter, sites.NextStartIndexFromSharePoint, webTemplate, formDigest, deleted, logger)
|
|
77
|
+
.getAllSites(spoAdminUrl, filter, sites.NextStartIndexFromSharePoint, personalSite, webTemplate, formDigest, deleted, logger)
|
|
75
78
|
.then(_ => resolve(), err => reject(err));
|
|
76
79
|
}
|
|
77
80
|
else {
|
|
@@ -81,15 +84,48 @@ class SpoSiteListCommand extends SpoCommand_1.default {
|
|
|
81
84
|
}, err => reject(err));
|
|
82
85
|
});
|
|
83
86
|
}
|
|
87
|
+
/*
|
|
88
|
+
The type property currently defaults to Teamsite.
|
|
89
|
+
It makes more sense to default to All. Certainly after adding the 'includeOneDriveSites' option.
|
|
90
|
+
Changing this will be a breaking change. We'll remove the default the next major version.
|
|
91
|
+
*/
|
|
92
|
+
getWebTemplateId(options) {
|
|
93
|
+
if (options.webTemplate) {
|
|
94
|
+
return options.webTemplate;
|
|
95
|
+
}
|
|
96
|
+
if (options.includeOneDriveSites) {
|
|
97
|
+
return '';
|
|
98
|
+
}
|
|
99
|
+
let siteType = options.type;
|
|
100
|
+
if (!siteType) {
|
|
101
|
+
siteType = 'TeamSite';
|
|
102
|
+
}
|
|
103
|
+
switch (siteType) {
|
|
104
|
+
case "TeamSite":
|
|
105
|
+
return 'GROUP#0';
|
|
106
|
+
case "CommunicationSite":
|
|
107
|
+
return 'SITEPAGEPUBLISHING#0';
|
|
108
|
+
default:
|
|
109
|
+
return '';
|
|
110
|
+
}
|
|
111
|
+
}
|
|
84
112
|
options() {
|
|
85
113
|
const options = [
|
|
86
114
|
{
|
|
87
|
-
option: '--type [type]',
|
|
88
|
-
|
|
115
|
+
option: '-t, --type [type]',
|
|
116
|
+
// To not introduce a breaking change, 'All' has been added.
|
|
117
|
+
// You should use all when using '--includeOneDriveSites'
|
|
118
|
+
autocomplete: ['TeamSite', 'CommunicationSite', 'All']
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
option: '--webTemplate [webTemplate]'
|
|
89
122
|
},
|
|
90
123
|
{
|
|
91
124
|
option: '-f, --filter [filter]'
|
|
92
125
|
},
|
|
126
|
+
{
|
|
127
|
+
option: '--includeOneDriveSites'
|
|
128
|
+
},
|
|
93
129
|
{
|
|
94
130
|
option: '--deleted'
|
|
95
131
|
}
|
|
@@ -98,11 +134,17 @@ class SpoSiteListCommand extends SpoCommand_1.default {
|
|
|
98
134
|
return options.concat(parentOptions);
|
|
99
135
|
}
|
|
100
136
|
validate(args) {
|
|
101
|
-
if (args.options.type) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
137
|
+
if (args.options.type && args.options.webTemplate) {
|
|
138
|
+
return 'Specify either type or webTemplate, but not both';
|
|
139
|
+
}
|
|
140
|
+
const typeValues = ['TeamSite', 'CommunicationSite', 'All'];
|
|
141
|
+
if (args.options.type &&
|
|
142
|
+
typeValues.indexOf(args.options.type) < 0) {
|
|
143
|
+
return `${args.options.type} is not a valid value for the type option. Allowed values are ${typeValues.join('|')}`;
|
|
144
|
+
}
|
|
145
|
+
if (args.options.includeOneDriveSites
|
|
146
|
+
&& (!args.options.type || args.options.type !== 'All')) {
|
|
147
|
+
return 'When using includeOneDriveSites, specify All as value for type';
|
|
106
148
|
}
|
|
107
149
|
return true;
|
|
108
150
|
}
|
|
@@ -63,9 +63,11 @@ exports.default = {
|
|
|
63
63
|
FOLDER_REMOVE: `${prefix} folder remove`,
|
|
64
64
|
FOLDER_RENAME: `${prefix} folder rename`,
|
|
65
65
|
GET: `${prefix} get`,
|
|
66
|
+
GROUP_ADD: `${prefix} group add`,
|
|
66
67
|
GROUP_GET: `${prefix} group get`,
|
|
67
68
|
GROUP_LIST: `${prefix} group list`,
|
|
68
69
|
GROUP_REMOVE: `${prefix} group remove`,
|
|
70
|
+
GROUP_SET: `${prefix} group set`,
|
|
69
71
|
GROUP_USER_ADD: `${prefix} group user add`,
|
|
70
72
|
GROUP_USER_LIST: `${prefix} group user list`,
|
|
71
73
|
GROUP_USER_REMOVE: `${prefix} group user remove`,
|
|
@@ -167,6 +169,7 @@ exports.default = {
|
|
|
167
169
|
REPORT_SITEUSAGEPAGES: `${prefix} report siteusagepages`,
|
|
168
170
|
REPORT_SITEUSAGESITECOUNTS: `${prefix} report siteusagesitecounts`,
|
|
169
171
|
REPORT_SITEUSAGESTORAGE: `${prefix} report siteusagestorage`,
|
|
172
|
+
ROLEDEFINITION_GET: `${prefix} roledefinition get`,
|
|
170
173
|
ROLEDEFINITION_LIST: `${prefix} roledefinition list`,
|
|
171
174
|
ROLEDEFINITION_REMOVE: `${prefix} roledefinition remove`,
|
|
172
175
|
SEARCH: `${prefix} search`,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const request_1 = require("../../../../request");
|
|
4
4
|
const utils_1 = require("../../../../utils");
|
|
5
|
+
const aadGroup_1 = require("../../../../utils/aadGroup");
|
|
5
6
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
6
7
|
const commands_1 = require("../../commands");
|
|
7
8
|
class TeamsTeamArchiveCommand extends GraphCommand_1.default {
|
|
@@ -16,27 +17,53 @@ class TeamsTeamArchiveCommand extends GraphCommand_1.default {
|
|
|
16
17
|
telemetryProps.shouldSetSpoSiteReadOnlyForMembers = args.options.shouldSetSpoSiteReadOnlyForMembers === true;
|
|
17
18
|
return telemetryProps;
|
|
18
19
|
}
|
|
20
|
+
getTeamId(args) {
|
|
21
|
+
if (args.options.id) {
|
|
22
|
+
return Promise.resolve(args.options.id);
|
|
23
|
+
}
|
|
24
|
+
return aadGroup_1.aadGroup
|
|
25
|
+
.getGroupByDisplayName(args.options.name)
|
|
26
|
+
.then(group => {
|
|
27
|
+
if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
|
|
28
|
+
return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
|
|
29
|
+
}
|
|
30
|
+
return group.id;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
19
33
|
commandAction(logger, args, cb) {
|
|
34
|
+
if (args.options.teamId) {
|
|
35
|
+
args.options.id = args.options.teamId;
|
|
36
|
+
this.warn(logger, `Option 'teamId' is deprecated. Please use 'id' instead.`);
|
|
37
|
+
}
|
|
20
38
|
const siteReadOnlyForMembers = args.options.shouldSetSpoSiteReadOnlyForMembers === true;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
39
|
+
this
|
|
40
|
+
.getTeamId(args)
|
|
41
|
+
.then((teamId) => {
|
|
42
|
+
const requestOptions = {
|
|
43
|
+
url: `${this.resource}/v1.0/teams/${encodeURIComponent(teamId)}/archive`,
|
|
44
|
+
headers: {
|
|
45
|
+
'content-type': 'application/json;odata=nometadata',
|
|
46
|
+
'accept': 'application/json;odata.metadata=none'
|
|
47
|
+
},
|
|
48
|
+
responseType: 'json',
|
|
49
|
+
data: {
|
|
50
|
+
shouldSetSpoSiteReadOnlyForMembers: siteReadOnlyForMembers
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
return request_1.default.post(requestOptions);
|
|
54
|
+
})
|
|
34
55
|
.then(_ => cb(), (res) => this.handleRejectedODataJsonPromise(res, logger, cb));
|
|
35
56
|
}
|
|
36
57
|
options() {
|
|
37
58
|
const options = [
|
|
38
59
|
{
|
|
39
|
-
option: '-i, --
|
|
60
|
+
option: '-i, --id [id]'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
option: '-n, --name [name]'
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
option: '--teamId [teamId]'
|
|
40
67
|
},
|
|
41
68
|
{
|
|
42
69
|
option: '--shouldSetSpoSiteReadOnlyForMembers'
|
|
@@ -46,9 +73,18 @@ class TeamsTeamArchiveCommand extends GraphCommand_1.default {
|
|
|
46
73
|
return options.concat(parentOptions);
|
|
47
74
|
}
|
|
48
75
|
validate(args) {
|
|
49
|
-
if (!
|
|
76
|
+
if (!args.options.id && !args.options.name && !args.options.teamId) {
|
|
77
|
+
return 'Specify either id or name';
|
|
78
|
+
}
|
|
79
|
+
if (args.options.name && (args.options.id || args.options.teamId)) {
|
|
80
|
+
return 'Specify either id or name but not both';
|
|
81
|
+
}
|
|
82
|
+
if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
|
|
50
83
|
return `${args.options.teamId} is not a valid GUID`;
|
|
51
84
|
}
|
|
85
|
+
if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
|
|
86
|
+
return `${args.options.id} is not a valid GUID`;
|
|
87
|
+
}
|
|
52
88
|
return true;
|
|
53
89
|
}
|
|
54
90
|
}
|
|
@@ -3,6 +3,7 @@ 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 aadGroup_1 = require("../../../../utils/aadGroup");
|
|
6
7
|
const GraphCommand_1 = require("../../../base/GraphCommand");
|
|
7
8
|
const commands_1 = require("../../commands");
|
|
8
9
|
class TeamsTeamRemoveCommand extends GraphCommand_1.default {
|
|
@@ -17,17 +18,37 @@ class TeamsTeamRemoveCommand extends GraphCommand_1.default {
|
|
|
17
18
|
telemetryProps.confirm = (!(!args.options.confirm)).toString();
|
|
18
19
|
return telemetryProps;
|
|
19
20
|
}
|
|
21
|
+
getTeamId(args) {
|
|
22
|
+
if (args.options.id) {
|
|
23
|
+
return Promise.resolve(args.options.id);
|
|
24
|
+
}
|
|
25
|
+
return aadGroup_1.aadGroup
|
|
26
|
+
.getGroupByDisplayName(args.options.name)
|
|
27
|
+
.then(group => {
|
|
28
|
+
if (group.resourceProvisioningOptions.indexOf('Team') === -1) {
|
|
29
|
+
return Promise.reject(`The specified team does not exist in the Microsoft Teams`);
|
|
30
|
+
}
|
|
31
|
+
return group.id;
|
|
32
|
+
});
|
|
33
|
+
}
|
|
20
34
|
commandAction(logger, args, cb) {
|
|
35
|
+
if (args.options.teamId) {
|
|
36
|
+
args.options.id = args.options.teamId;
|
|
37
|
+
this.warn(logger, `Option 'teamId' is deprecated. Please use 'id' instead.`);
|
|
38
|
+
}
|
|
21
39
|
const removeTeam = () => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
this
|
|
41
|
+
.getTeamId(args)
|
|
42
|
+
.then((teamId) => {
|
|
43
|
+
const requestOptions = {
|
|
44
|
+
url: `${this.resource}/v1.0/groups/${encodeURIComponent(teamId)}`,
|
|
45
|
+
headers: {
|
|
46
|
+
accept: 'application/json;odata.metadata=none'
|
|
47
|
+
},
|
|
48
|
+
responseType: 'json'
|
|
49
|
+
};
|
|
50
|
+
return request_1.default.delete(requestOptions);
|
|
51
|
+
})
|
|
31
52
|
.then(_ => cb(), (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
32
53
|
};
|
|
33
54
|
if (args.options.confirm) {
|
|
@@ -52,7 +73,13 @@ class TeamsTeamRemoveCommand extends GraphCommand_1.default {
|
|
|
52
73
|
options() {
|
|
53
74
|
const options = [
|
|
54
75
|
{
|
|
55
|
-
option: '-i, --
|
|
76
|
+
option: '-i, --id [id]'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
option: '-n, --name [name]'
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
option: '--teamId [teamId]'
|
|
56
83
|
},
|
|
57
84
|
{
|
|
58
85
|
option: '--confirm'
|
|
@@ -62,9 +89,18 @@ class TeamsTeamRemoveCommand extends GraphCommand_1.default {
|
|
|
62
89
|
return options.concat(parentOptions);
|
|
63
90
|
}
|
|
64
91
|
validate(args) {
|
|
65
|
-
if (!
|
|
92
|
+
if (!args.options.id && !args.options.name && !args.options.teamId) {
|
|
93
|
+
return 'Specify either id or name';
|
|
94
|
+
}
|
|
95
|
+
if (args.options.name && (args.options.id || args.options.teamId)) {
|
|
96
|
+
return 'Specify either id or name but not both';
|
|
97
|
+
}
|
|
98
|
+
if (args.options.teamId && !utils_1.validation.isValidGuid(args.options.teamId)) {
|
|
66
99
|
return `${args.options.teamId} is not a valid GUID`;
|
|
67
100
|
}
|
|
101
|
+
if (args.options.id && !utils_1.validation.isValidGuid(args.options.id)) {
|
|
102
|
+
return `${args.options.id} is not a valid GUID`;
|
|
103
|
+
}
|
|
68
104
|
return true;
|
|
69
105
|
}
|
|
70
106
|
}
|