@pnp/cli-microsoft365 6.0.0-beta.e031afa → 6.0.0-beta.e1e0a1b
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/planner/commands/bucket/bucket-add.js +4 -12
- package/dist/m365/planner/commands/bucket/bucket-get.js +4 -12
- package/dist/m365/planner/commands/bucket/bucket-list.js +4 -12
- package/dist/m365/planner/commands/bucket/bucket-remove.js +4 -12
- package/dist/m365/planner/commands/bucket/bucket-set.js +4 -12
- package/dist/m365/planner/commands/task/task-add.js +4 -10
- package/dist/m365/planner/commands/task/task-get.js +4 -10
- package/dist/m365/planner/commands/task/task-list.js +4 -12
- package/dist/m365/planner/commands/task/task-set.js +4 -10
- package/dist/m365/spo/commands/site/site-list.js +6 -17
- package/dist/m365/spo/commands.js +0 -3
- package/docs/docs/cmd/planner/bucket/bucket-add.md +0 -3
- package/docs/docs/cmd/planner/bucket/bucket-get.md +0 -3
- package/docs/docs/cmd/planner/bucket/bucket-list.md +0 -3
- package/docs/docs/cmd/planner/bucket/bucket-remove.md +0 -3
- package/docs/docs/cmd/planner/bucket/bucket-set.md +0 -3
- package/docs/docs/cmd/planner/task/task-add.md +0 -3
- package/docs/docs/cmd/planner/task/task-get.md +0 -3
- package/docs/docs/cmd/planner/task/task-list.md +0 -3
- package/docs/docs/cmd/planner/task/task-set.md +0 -3
- package/docs/docs/cmd/spo/site/site-list.md +6 -6
- package/package.json +1 -1
- package/dist/m365/spo/commands/site/site-classic-add.js +0 -333
- package/dist/m365/spo/commands/site/site-classic-list.js +0 -99
- package/dist/m365/spo/commands/site/site-classic-set.js +0 -359
- package/docs/docs/cmd/spo/site/site-classic-add.md +0 -93
- package/docs/docs/cmd/spo/site/site-classic-list.md +0 -68
- package/docs/docs/cmd/spo/site/site-classic-set.md +0 -102
|
@@ -11,16 +11,16 @@ m365 spo site list [options]
|
|
|
11
11
|
## Options
|
|
12
12
|
|
|
13
13
|
`-t, --type [type]`
|
|
14
|
-
: type of sites to list. Allowed values are `TeamSite,CommunicationSite
|
|
14
|
+
: convenience option for type of sites to list. Allowed values are `TeamSite,CommunicationSite`.
|
|
15
15
|
|
|
16
16
|
`--webTemplate [webTemplate]`
|
|
17
|
-
:
|
|
17
|
+
: type of sites to list. To be used with values like `GROUP#0` and `SITEPAGEPUBLISHING#0`. Specify either `type` or `webTemplate`, but not both.
|
|
18
18
|
|
|
19
19
|
`-f, --filter [filter]`
|
|
20
20
|
: filter to apply when retrieving sites
|
|
21
21
|
|
|
22
22
|
`--includeOneDriveSites`
|
|
23
|
-
: use this switch to include OneDrive sites in the result when retrieving sites.
|
|
23
|
+
: use this switch to include OneDrive sites in the result when retrieving sites. Do not specify the `type` or `webTemplate` options when using this.
|
|
24
24
|
|
|
25
25
|
`--deleted`
|
|
26
26
|
: use this switch to only return deleted sites
|
|
@@ -34,14 +34,14 @@ m365 spo site list [options]
|
|
|
34
34
|
|
|
35
35
|
Using the `-f, --filter` option you can specify which sites you want to retrieve. For example, to get sites with _project_ in their URL, use `Url -like 'project'` as the filter.
|
|
36
36
|
|
|
37
|
-
When using the text output type
|
|
37
|
+
When using the text output type, the command lists only the values of the `Title`, and `Url` properties of the site. When setting the output type to JSON, all available properties are included in the command output.
|
|
38
38
|
|
|
39
39
|
## Examples
|
|
40
40
|
|
|
41
41
|
List all sites in the currently connected tenant
|
|
42
42
|
|
|
43
43
|
```sh
|
|
44
|
-
m365 spo site list
|
|
44
|
+
m365 spo site list
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
List all group connected team sites in the currently connected tenant
|
|
@@ -65,7 +65,7 @@ m365 spo site list --type TeamSite --filter "Url -like 'project'"
|
|
|
65
65
|
List all sites in the currently connected tenant including OneDrive sites
|
|
66
66
|
|
|
67
67
|
```sh
|
|
68
|
-
m365 spo site list --
|
|
68
|
+
m365 spo site list --includeOneDriveSites
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
List all deleted sites in the tenant you're logged in to
|
package/package.json
CHANGED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const config_1 = require("../../../../config");
|
|
4
|
-
const request_1 = require("../../../../request");
|
|
5
|
-
const utils_1 = require("../../../../utils");
|
|
6
|
-
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
7
|
-
const commands_1 = require("../../commands");
|
|
8
|
-
class SpoSiteClassicAddCommand extends SpoCommand_1.default {
|
|
9
|
-
get name() {
|
|
10
|
-
return commands_1.default.SITE_CLASSIC_ADD;
|
|
11
|
-
}
|
|
12
|
-
get description() {
|
|
13
|
-
return 'Creates new classic site';
|
|
14
|
-
}
|
|
15
|
-
getTelemetryProperties(args) {
|
|
16
|
-
const telemetryProps = super.getTelemetryProperties(args);
|
|
17
|
-
telemetryProps.lcid = typeof args.options.lcid !== 'undefined';
|
|
18
|
-
telemetryProps.webTemplate = typeof args.options.webTemplate !== 'undefined';
|
|
19
|
-
telemetryProps.resourceQuota = typeof args.options.resourceQuota !== 'undefined';
|
|
20
|
-
telemetryProps.resourceQuotaWarningLevel = typeof args.options.resourceQuotaWarningLevel !== 'undefined';
|
|
21
|
-
telemetryProps.storageQuota = typeof args.options.storageQuota !== 'undefined';
|
|
22
|
-
telemetryProps.storageQuotaWarningLevel = typeof args.options.storageQuotaWarningLevel !== 'undefined';
|
|
23
|
-
telemetryProps.removeDeletedSite = args.options.removeDeletedSite;
|
|
24
|
-
telemetryProps.wait = args.options.wait;
|
|
25
|
-
return telemetryProps;
|
|
26
|
-
}
|
|
27
|
-
commandAction(logger, args, cb) {
|
|
28
|
-
this.dots = '';
|
|
29
|
-
this.showDeprecationWarning(logger, commands_1.default.SITE_CLASSIC_ADD, commands_1.default.SITE_ADD);
|
|
30
|
-
utils_1.spo
|
|
31
|
-
.getSpoAdminUrl(logger, this.debug)
|
|
32
|
-
.then((_spoAdminUrl) => {
|
|
33
|
-
this.spoAdminUrl = _spoAdminUrl;
|
|
34
|
-
return utils_1.spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
|
|
35
|
-
})
|
|
36
|
-
.then((res) => {
|
|
37
|
-
this.context = res;
|
|
38
|
-
if (args.options.removeDeletedSite) {
|
|
39
|
-
return this.siteExistsInTheRecycleBin(args.options.url, logger);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
// assume site doesn't exist
|
|
43
|
-
return Promise.resolve(false);
|
|
44
|
-
}
|
|
45
|
-
})
|
|
46
|
-
.then((exists) => {
|
|
47
|
-
if (exists) {
|
|
48
|
-
if (this.verbose) {
|
|
49
|
-
logger.logToStderr('Site exists in the recycle bin');
|
|
50
|
-
}
|
|
51
|
-
return this.deleteSiteFromTheRecycleBin(args.options.url, args.options.wait, logger);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
if (this.verbose) {
|
|
55
|
-
logger.logToStderr('Site not found');
|
|
56
|
-
}
|
|
57
|
-
return Promise.resolve();
|
|
58
|
-
}
|
|
59
|
-
})
|
|
60
|
-
.then(() => {
|
|
61
|
-
return utils_1.spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
|
|
62
|
-
})
|
|
63
|
-
.then((res) => {
|
|
64
|
-
this.context = res;
|
|
65
|
-
if (this.verbose) {
|
|
66
|
-
logger.logToStderr(`Creating site collection ${args.options.url}...`);
|
|
67
|
-
}
|
|
68
|
-
const lcid = typeof args.options.lcid === 'number' ? args.options.lcid : 1033;
|
|
69
|
-
const storageQuota = typeof args.options.storageQuota === 'number' ? args.options.storageQuota : 100;
|
|
70
|
-
const storageQuotaWarningLevel = typeof args.options.storageQuotaWarningLevel === 'number' ? args.options.storageQuotaWarningLevel : 100;
|
|
71
|
-
const resourceQuota = typeof args.options.resourceQuota === 'number' ? args.options.resourceQuota : 0;
|
|
72
|
-
const resourceQuotaWarningLevel = typeof args.options.resourceQuotaWarningLevel === 'number' ? args.options.resourceQuotaWarningLevel : 0;
|
|
73
|
-
const webTemplate = args.options.webTemplate || 'STS#0';
|
|
74
|
-
const requestOptions = {
|
|
75
|
-
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
76
|
-
headers: {
|
|
77
|
-
'X-RequestDigest': this.context.FormDigestValue
|
|
78
|
-
},
|
|
79
|
-
data: `<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="3"><Query SelectAllProperties="true"><Properties /></Query></Query><Query Id="8" ObjectPathId="5"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Constructor Id="3" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="5" ParentId="3" Name="CreateSite"><Parameters><Parameter TypeId="{11f84fff-b8cf-47b6-8b50-34e692656606}"><Property Name="CompatibilityLevel" Type="Int32">0</Property><Property Name="Lcid" Type="UInt32">${lcid}</Property><Property Name="Owner" Type="String">${utils_1.formatting.escapeXml(args.options.owner)}</Property><Property Name="StorageMaximumLevel" Type="Int64">${storageQuota}</Property><Property Name="StorageWarningLevel" Type="Int64">${storageQuotaWarningLevel}</Property><Property Name="Template" Type="String">${utils_1.formatting.escapeXml(webTemplate)}</Property><Property Name="TimeZoneId" Type="Int32">${args.options.timeZone}</Property><Property Name="Title" Type="String">${utils_1.formatting.escapeXml(args.options.title)}</Property><Property Name="Url" Type="String">${utils_1.formatting.escapeXml(args.options.url)}</Property><Property Name="UserCodeMaximumLevel" Type="Double">${resourceQuota}</Property><Property Name="UserCodeWarningLevel" Type="Double">${resourceQuotaWarningLevel}</Property></Parameter></Parameters></Method></ObjectPaths></Request>`
|
|
80
|
-
};
|
|
81
|
-
return request_1.default.post(requestOptions);
|
|
82
|
-
})
|
|
83
|
-
.then((res) => {
|
|
84
|
-
return new Promise((resolve, reject) => {
|
|
85
|
-
const json = JSON.parse(res);
|
|
86
|
-
const response = json[0];
|
|
87
|
-
if (response.ErrorInfo) {
|
|
88
|
-
reject(response.ErrorInfo.ErrorMessage);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
const operation = json[json.length - 1];
|
|
92
|
-
const isComplete = operation.IsComplete;
|
|
93
|
-
if (!args.options.wait || isComplete) {
|
|
94
|
-
resolve();
|
|
95
|
-
return;
|
|
96
|
-
}
|
|
97
|
-
setTimeout(() => {
|
|
98
|
-
utils_1.spo.waitUntilFinished({
|
|
99
|
-
operationId: JSON.stringify(operation._ObjectIdentity_),
|
|
100
|
-
siteUrl: this.spoAdminUrl,
|
|
101
|
-
resolve,
|
|
102
|
-
reject,
|
|
103
|
-
logger,
|
|
104
|
-
currentContext: this.context,
|
|
105
|
-
dots: this.dots,
|
|
106
|
-
debug: this.debug,
|
|
107
|
-
verbose: this.verbose
|
|
108
|
-
});
|
|
109
|
-
}, operation.PollingInterval);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
})
|
|
113
|
-
.then(_ => cb(), (err) => this.handleRejectedPromise(err, logger, cb));
|
|
114
|
-
}
|
|
115
|
-
siteExistsInTheRecycleBin(url, logger) {
|
|
116
|
-
return new Promise((resolve, reject) => {
|
|
117
|
-
utils_1.spo
|
|
118
|
-
.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug)
|
|
119
|
-
.then((res) => {
|
|
120
|
-
this.context = res;
|
|
121
|
-
if (this.verbose) {
|
|
122
|
-
logger.logToStderr(`Checking if the site ${url} exists...`);
|
|
123
|
-
}
|
|
124
|
-
const requestOptions = {
|
|
125
|
-
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
126
|
-
headers: {
|
|
127
|
-
'X-RequestDigest': this.context.FormDigestValue
|
|
128
|
-
},
|
|
129
|
-
data: `<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="197" ObjectPathId="196" /><ObjectPath Id="199" ObjectPathId="198" /><Query Id="200" ObjectPathId="198"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><Constructor Id="196" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="198" ParentId="196" Name="GetSitePropertiesByUrl"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(url)}</Parameter><Parameter Type="Boolean">false</Parameter></Parameters></Method></ObjectPaths></Request>`
|
|
130
|
-
};
|
|
131
|
-
return request_1.default.post(requestOptions);
|
|
132
|
-
})
|
|
133
|
-
.then((res) => {
|
|
134
|
-
const json = JSON.parse(res);
|
|
135
|
-
const response = json[0];
|
|
136
|
-
if (response.ErrorInfo) {
|
|
137
|
-
if (response.ErrorInfo.ErrorTypeName === 'Microsoft.Online.SharePoint.Common.SpoNoSiteException') {
|
|
138
|
-
return Promise.resolve(false);
|
|
139
|
-
}
|
|
140
|
-
else {
|
|
141
|
-
return Promise.reject(response.ErrorInfo.ErrorMessage);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
else {
|
|
145
|
-
const site = json[json.length - 1];
|
|
146
|
-
if (site.Status === 'Recycled') {
|
|
147
|
-
return Promise.reject(true);
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
return Promise.resolve(false);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
})
|
|
154
|
-
.then(() => {
|
|
155
|
-
if (this.verbose) {
|
|
156
|
-
logger.logToStderr(`Site doesn't exist. Checking if the site ${url} exists in the recycle bin...`);
|
|
157
|
-
}
|
|
158
|
-
const requestOptions = {
|
|
159
|
-
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
160
|
-
headers: {
|
|
161
|
-
'X-RequestDigest': this.context.FormDigestValue
|
|
162
|
-
},
|
|
163
|
-
data: `<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="181" ObjectPathId="180" /><Query Id="182" ObjectPathId="180"><Query SelectAllProperties="true"><Properties /></Query></Query></Actions><ObjectPaths><Method Id="180" ParentId="175" Name="GetDeletedSitePropertiesByUrl"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(url)}</Parameter></Parameters></Method><Constructor Id="175" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
164
|
-
};
|
|
165
|
-
return request_1.default.post(requestOptions);
|
|
166
|
-
})
|
|
167
|
-
.then((res) => {
|
|
168
|
-
const json = JSON.parse(res);
|
|
169
|
-
const response = json[0];
|
|
170
|
-
if (response.ErrorInfo) {
|
|
171
|
-
if (response.ErrorInfo.ErrorTypeName === 'Microsoft.SharePoint.Client.UnknownError') {
|
|
172
|
-
resolve(false);
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
reject(response.ErrorInfo.ErrorMessage);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
const site = json[json.length - 1];
|
|
180
|
-
if (site.Status === 'Recycled') {
|
|
181
|
-
resolve(true);
|
|
182
|
-
}
|
|
183
|
-
else {
|
|
184
|
-
resolve(false);
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}, (error) => {
|
|
188
|
-
if (typeof error === 'boolean') {
|
|
189
|
-
resolve(error);
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
reject(error);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
}
|
|
197
|
-
deleteSiteFromTheRecycleBin(url, wait, logger) {
|
|
198
|
-
return new Promise((resolve, reject) => {
|
|
199
|
-
utils_1.spo
|
|
200
|
-
.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug)
|
|
201
|
-
.then((res) => {
|
|
202
|
-
this.context = res;
|
|
203
|
-
if (this.verbose) {
|
|
204
|
-
logger.logToStderr(`Deleting site ${url} from the recycle bin...`);
|
|
205
|
-
}
|
|
206
|
-
const requestOptions = {
|
|
207
|
-
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
208
|
-
headers: {
|
|
209
|
-
'X-RequestDigest': this.context.FormDigestValue
|
|
210
|
-
},
|
|
211
|
-
data: `<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="185" ObjectPathId="184" /><Query Id="186" ObjectPathId="184"><Query SelectAllProperties="false"><Properties><Property Name="IsComplete" ScalarProperty="true" /><Property Name="PollingInterval" ScalarProperty="true" /></Properties></Query></Query></Actions><ObjectPaths><Method Id="184" ParentId="175" Name="RemoveDeletedSite"><Parameters><Parameter Type="String">${utils_1.formatting.escapeXml(url)}</Parameter></Parameters></Method><Constructor Id="175" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
|
|
212
|
-
};
|
|
213
|
-
return request_1.default.post(requestOptions);
|
|
214
|
-
})
|
|
215
|
-
.then((res) => {
|
|
216
|
-
const json = JSON.parse(res);
|
|
217
|
-
const response = json[0];
|
|
218
|
-
if (response.ErrorInfo) {
|
|
219
|
-
reject(response.ErrorInfo.ErrorMessage);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
const operation = json[json.length - 1];
|
|
223
|
-
const isComplete = operation.IsComplete;
|
|
224
|
-
if (!wait || isComplete) {
|
|
225
|
-
resolve();
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
setTimeout(() => {
|
|
229
|
-
utils_1.spo.waitUntilFinished({
|
|
230
|
-
operationId: JSON.stringify(operation._ObjectIdentity_),
|
|
231
|
-
siteUrl: this.spoAdminUrl,
|
|
232
|
-
resolve,
|
|
233
|
-
reject,
|
|
234
|
-
logger,
|
|
235
|
-
currentContext: this.context,
|
|
236
|
-
dots: this.dots,
|
|
237
|
-
verbose: this.verbose,
|
|
238
|
-
debug: this.debug
|
|
239
|
-
});
|
|
240
|
-
}, operation.PollingInterval);
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
options() {
|
|
246
|
-
const options = [
|
|
247
|
-
{
|
|
248
|
-
option: '-u, --url <url>'
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
option: '-t, --title <title>'
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
option: '--owner <owner>'
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
option: '-z, --timeZone <timeZone>'
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
option: '-l, --lcid [lcid]'
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
option: '-w, --webTemplate [webTemplate]'
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
option: '--resourceQuota [resourceQuota]'
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
option: '--resourceQuotaWarningLevel [resourceQuotaWarningLevel]'
|
|
270
|
-
},
|
|
271
|
-
{
|
|
272
|
-
option: '--storageQuota [storageQuota]'
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
option: '--storageQuotaWarningLevel [storageQuotaWarningLevel]'
|
|
276
|
-
},
|
|
277
|
-
{
|
|
278
|
-
option: '--removeDeletedSite'
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
option: '--wait'
|
|
282
|
-
}
|
|
283
|
-
];
|
|
284
|
-
const parentOptions = super.options();
|
|
285
|
-
return options.concat(parentOptions);
|
|
286
|
-
}
|
|
287
|
-
validate(args) {
|
|
288
|
-
const isValidSharePointUrl = utils_1.validation.isValidSharePointUrl(args.options.url);
|
|
289
|
-
if (isValidSharePointUrl !== true) {
|
|
290
|
-
return isValidSharePointUrl;
|
|
291
|
-
}
|
|
292
|
-
if (typeof args.options.timeZone !== 'number') {
|
|
293
|
-
return `${args.options.timeZone} is not a number`;
|
|
294
|
-
}
|
|
295
|
-
if (args.options.lcid &&
|
|
296
|
-
typeof args.options.lcid !== 'number') {
|
|
297
|
-
return `${args.options.lcid} is not a number`;
|
|
298
|
-
}
|
|
299
|
-
if (args.options.resourceQuota &&
|
|
300
|
-
typeof args.options.resourceQuota !== 'number') {
|
|
301
|
-
return `${args.options.resourceQuota} is not a number`;
|
|
302
|
-
}
|
|
303
|
-
if (args.options.resourceQuotaWarningLevel &&
|
|
304
|
-
typeof args.options.resourceQuotaWarningLevel !== 'number') {
|
|
305
|
-
return `${args.options.resourceQuotaWarningLevel} is not a number`;
|
|
306
|
-
}
|
|
307
|
-
if (args.options.resourceQuotaWarningLevel &&
|
|
308
|
-
!args.options.resourceQuota) {
|
|
309
|
-
return `You cannot specify resourceQuotaWarningLevel without specifying resourceQuota`;
|
|
310
|
-
}
|
|
311
|
-
if (args.options.resourceQuotaWarningLevel > args.options.resourceQuota) {
|
|
312
|
-
return `resourceQuotaWarningLevel cannot exceed resourceQuota`;
|
|
313
|
-
}
|
|
314
|
-
if (args.options.storageQuota &&
|
|
315
|
-
typeof args.options.storageQuota !== 'number') {
|
|
316
|
-
return `${args.options.storageQuota} is not a number`;
|
|
317
|
-
}
|
|
318
|
-
if (args.options.storageQuotaWarningLevel &&
|
|
319
|
-
typeof args.options.storageQuotaWarningLevel !== 'number') {
|
|
320
|
-
return `${args.options.storageQuotaWarningLevel} is not a number`;
|
|
321
|
-
}
|
|
322
|
-
if (args.options.storageQuotaWarningLevel &&
|
|
323
|
-
!args.options.storageQuota) {
|
|
324
|
-
return `You cannot specify storageQuotaWarningLevel without specifying storageQuota`;
|
|
325
|
-
}
|
|
326
|
-
if (args.options.storageQuotaWarningLevel > args.options.storageQuota) {
|
|
327
|
-
return `storageQuotaWarningLevel cannot exceed storageQuota`;
|
|
328
|
-
}
|
|
329
|
-
return true;
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
module.exports = new SpoSiteClassicAddCommand();
|
|
333
|
-
//# sourceMappingURL=site-classic-add.js.map
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const config_1 = require("../../../../config");
|
|
4
|
-
const request_1 = require("../../../../request");
|
|
5
|
-
const utils_1 = require("../../../../utils");
|
|
6
|
-
const SpoCommand_1 = require("../../../base/SpoCommand");
|
|
7
|
-
const commands_1 = require("../../commands");
|
|
8
|
-
class SpoSiteClassicListCommand extends SpoCommand_1.default {
|
|
9
|
-
get name() {
|
|
10
|
-
return commands_1.default.SITE_CLASSIC_LIST;
|
|
11
|
-
}
|
|
12
|
-
get description() {
|
|
13
|
-
return 'Lists sites of the given type';
|
|
14
|
-
}
|
|
15
|
-
getTelemetryProperties(args) {
|
|
16
|
-
const telemetryProps = super.getTelemetryProperties(args);
|
|
17
|
-
telemetryProps.webTemplate = args.options.webTemplate;
|
|
18
|
-
telemetryProps.filter = (!(!args.options.filter)).toString();
|
|
19
|
-
telemetryProps.includeOneDriveSites = args.options.includeOneDriveSites;
|
|
20
|
-
return telemetryProps;
|
|
21
|
-
}
|
|
22
|
-
defaultProperties() {
|
|
23
|
-
return ['Title', 'Url'];
|
|
24
|
-
}
|
|
25
|
-
commandAction(logger, args, cb) {
|
|
26
|
-
this.showDeprecationWarning(logger, commands_1.default.SITE_CLASSIC_LIST, commands_1.default.SITE_LIST);
|
|
27
|
-
const webTemplate = args.options.webTemplate || '';
|
|
28
|
-
const includeOneDriveSites = args.options.includeOneDriveSites || false;
|
|
29
|
-
const personalSite = includeOneDriveSites === false ? '0' : '1';
|
|
30
|
-
let spoAdminUrl = '';
|
|
31
|
-
utils_1.spo
|
|
32
|
-
.getSpoAdminUrl(logger, this.debug)
|
|
33
|
-
.then((_spoAdminUrl) => {
|
|
34
|
-
spoAdminUrl = _spoAdminUrl;
|
|
35
|
-
if (this.verbose) {
|
|
36
|
-
logger.logToStderr(`Retrieving list of site collections...`);
|
|
37
|
-
}
|
|
38
|
-
this.allSites = [];
|
|
39
|
-
return this.getAllSites(spoAdminUrl, utils_1.formatting.escapeXml(args.options.filter || ''), '0', personalSite, webTemplate, undefined, logger);
|
|
40
|
-
})
|
|
41
|
-
.then(_ => {
|
|
42
|
-
logger.log(this.allSites);
|
|
43
|
-
cb();
|
|
44
|
-
}, (err) => this.handleRejectedPromise(err, logger, cb));
|
|
45
|
-
}
|
|
46
|
-
getAllSites(spoAdminUrl, filter, startIndex, personalSite, webTemplate, formDigest, logger) {
|
|
47
|
-
return new Promise((resolve, reject) => {
|
|
48
|
-
utils_1.spo
|
|
49
|
-
.ensureFormDigest(spoAdminUrl, logger, formDigest, this.debug)
|
|
50
|
-
.then((res) => {
|
|
51
|
-
const requestOptions = {
|
|
52
|
-
url: `${spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
|
|
53
|
-
headers: {
|
|
54
|
-
'X-RequestDigest': res.FormDigestValue
|
|
55
|
-
},
|
|
56
|
-
data: `<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>`
|
|
57
|
-
};
|
|
58
|
-
return request_1.default.post(requestOptions);
|
|
59
|
-
})
|
|
60
|
-
.then((res) => {
|
|
61
|
-
const json = JSON.parse(res);
|
|
62
|
-
const response = json[0];
|
|
63
|
-
if (response.ErrorInfo) {
|
|
64
|
-
reject(response.ErrorInfo.ErrorMessage);
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
const sites = json[json.length - 1];
|
|
69
|
-
this.allSites.push(...sites._Child_Items_);
|
|
70
|
-
if (sites.NextStartIndexFromSharePoint) {
|
|
71
|
-
this
|
|
72
|
-
.getAllSites(spoAdminUrl, filter, sites.NextStartIndexFromSharePoint, personalSite, webTemplate, formDigest, logger)
|
|
73
|
-
.then(_ => resolve(), err => reject(err));
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
resolve();
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}, err => reject(err));
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
options() {
|
|
83
|
-
const options = [
|
|
84
|
-
{
|
|
85
|
-
option: '-t, --webTemplate [webTemplate]'
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
option: '-f, --filter [filter]'
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
option: '--includeOneDriveSites'
|
|
92
|
-
}
|
|
93
|
-
];
|
|
94
|
-
const parentOptions = super.options();
|
|
95
|
-
return options.concat(parentOptions);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
module.exports = new SpoSiteClassicListCommand();
|
|
99
|
-
//# sourceMappingURL=site-classic-list.js.map
|