@pnp/cli-microsoft365 5.5.0-beta.f0f7ad7 → 5.6.0-beta.18a47a8
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/m365/aad/commands/o365group/o365group-recyclebinitem-restore.js +60 -9
- package/dist/m365/spo/commands/customaction/customaction-get.js +32 -4
- package/dist/m365/spo/commands/customaction/customaction-remove.js +43 -8
- package/dist/m365/spo/commands/field/field-get.js +14 -5
- package/dist/m365/spo/commands/field/field-remove.js +19 -10
- package/dist/m365/spo/commands/field/field-set.js +16 -9
- package/dist/m365/spo/commands/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/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 +2 -0
- package/dist/m365/teams/commands/tab/tab-get.js +2 -2
- package/dist/m365/teams/commands/team/team-clone.js +33 -7
- package/dist/m365/teams/commands/team/team-set.js +25 -5
- package/docs/docs/cmd/aad/o365group/o365group-recyclebinitem-restore.md +21 -3
- package/docs/docs/cmd/spo/customaction/customaction-get.md +15 -2
- package/docs/docs/cmd/spo/customaction/customaction-remove.md +33 -2
- package/docs/docs/cmd/spo/field/field-get.md +6 -3
- package/docs/docs/cmd/spo/field/field-remove.md +9 -6
- package/docs/docs/cmd/spo/field/field-set.md +7 -4
- package/docs/docs/cmd/spo/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/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/tab/tab-get.md +2 -2
- package/docs/docs/cmd/teams/team/team-clone.md +11 -5
- package/docs/docs/cmd/teams/team/team-set.md +10 -4
- package/npm-shrinkwrap.json +175 -160
- package/package.json +13 -13
|
@@ -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
|
|
@@ -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;
|
|
@@ -16,9 +18,24 @@ class SpoHubSiteGetCommand extends SpoCommand_1.default {
|
|
|
16
18
|
telemetryProps.id = typeof args.options.id !== 'undefined';
|
|
17
19
|
telemetryProps.title = typeof args.options.title !== 'undefined';
|
|
18
20
|
telemetryProps.url = typeof args.options.url !== 'undefined';
|
|
21
|
+
telemetryProps.includeAssociatedSites = args.options.includeAssociatedSites === true;
|
|
19
22
|
return telemetryProps;
|
|
20
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
|
+
}
|
|
21
37
|
commandAction(logger, args, cb) {
|
|
38
|
+
let hubSite;
|
|
22
39
|
utils_1.spo
|
|
23
40
|
.getSpoUrl(logger, this.debug)
|
|
24
41
|
.then((spoUrl) => {
|
|
@@ -30,7 +47,25 @@ class SpoHubSiteGetCommand extends SpoCommand_1.default {
|
|
|
30
47
|
}
|
|
31
48
|
})
|
|
32
49
|
.then((res) => {
|
|
33
|
-
|
|
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);
|
|
34
69
|
cb();
|
|
35
70
|
}, (err) => this.handleRejectedODataJsonPromise(err, logger, cb));
|
|
36
71
|
}
|
|
@@ -75,7 +110,8 @@ class SpoHubSiteGetCommand extends SpoCommand_1.default {
|
|
|
75
110
|
const options = [
|
|
76
111
|
{ option: '-i, --id [id]' },
|
|
77
112
|
{ option: '-t, --title [title]' },
|
|
78
|
-
{ option: '-u, --url [url]' }
|
|
113
|
+
{ option: '-u, --url [url]' },
|
|
114
|
+
{ option: '--includeAssociatedSites' }
|
|
79
115
|
];
|
|
80
116
|
const parentOptions = super.options();
|
|
81
117
|
return options.concat(parentOptions);
|
|
@@ -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';
|
|
@@ -29,6 +29,7 @@ class SpoSiteClassicSetCommand extends SpoCommand_1.default {
|
|
|
29
29
|
return telemetryProps;
|
|
30
30
|
}
|
|
31
31
|
commandAction(logger, args, cb) {
|
|
32
|
+
this.showDeprecationWarning(logger, commands_1.default.SITE_CLASSIC_SET, commands_1.default.SITE_SET);
|
|
32
33
|
this.dots = '';
|
|
33
34
|
utils_1.spo
|
|
34
35
|
.getTenantId(logger, this.debug)
|
|
@@ -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
|
}
|