@pnp/cli-microsoft365
Version:
Manage Microsoft 365 and SharePoint Framework projects on any platform
522 lines • 29.9 kB
JavaScript
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _SpoSiteAddCommand_instances, _SpoSiteAddCommand_initTelemetry, _SpoSiteAddCommand_initOptions, _SpoSiteAddCommand_initValidators;
import { setTimeout } from 'timers/promises';
import config from '../../../../config.js';
import request from '../../../../request.js';
import { formatting } from '../../../../utils/formatting.js';
import { spo } from '../../../../utils/spo.js';
import { validation } from '../../../../utils/validation.js';
import SpoCommand from '../../../base/SpoCommand.js';
import commands from '../../commands.js';
class SpoSiteAddCommand extends SpoCommand {
get supportedLcids() {
// Languages supported by SharePoint
// https://support.microsoft.com/en-us/office/languages-supported-by-sharepoint-dfbf3652-2902-4809-be21-9080b6512fff
// https://github.com/pnp/PnP-PowerShell/wiki/Supported-LCIDs-by-SharePoint
return [1025, 1068, 1069, 5146, 1026, 1027, 2052, 1028, 1050, 1029, 1030, 1043, 1033, 1061, 1035, 1036, 1110, 1031, 1032, 1037, 1081, 1038, 1057, 2108, 1040, 1041, 1087, 1042, 1062, 1063, 1071, 1086, 1044, 1045, 1046, 2070, 1048, 1049, 10266, 2074, 1051, 1060, 3082, 1053, 1054, 1055, 1058, 1066, 1106];
}
get name() {
return commands.SITE_ADD;
}
get description() {
return 'Creates new SharePoint Online site';
}
constructor() {
super();
_SpoSiteAddCommand_instances.add(this);
__classPrivateFieldGet(this, _SpoSiteAddCommand_instances, "m", _SpoSiteAddCommand_initTelemetry).call(this);
__classPrivateFieldGet(this, _SpoSiteAddCommand_instances, "m", _SpoSiteAddCommand_initOptions).call(this);
__classPrivateFieldGet(this, _SpoSiteAddCommand_instances, "m", _SpoSiteAddCommand_initValidators).call(this);
}
async commandAction(logger, args) {
const isClassicSite = args.options.type === 'ClassicSite';
const siteUrl = isClassicSite
? await this.createClassicSite(logger, args)
: await this.createModernSite(logger, args);
if (siteUrl && args.options.withAppCatalog) {
await this.addAppCatalog(siteUrl, logger);
}
await logger.log(siteUrl);
}
async createModernSite(logger, args) {
const isTeamSite = args.options.type !== 'CommunicationSite';
try {
const spoUrl = await spo.getSpoUrl(logger, this.debug);
if (this.verbose) {
await logger.logToStderr(`Creating new site...`);
}
let requestOptions = {};
if (isTeamSite) {
requestOptions = {
url: `${spoUrl}/_api/GroupSiteManager/CreateGroupEx`,
headers: {
'content-type': 'application/json; odata=verbose; charset=utf-8',
accept: 'application/json;odata=nometadata'
},
responseType: 'json',
data: {
displayName: args.options.title,
alias: args.options.alias,
isPublic: args.options.isPublic,
optionalParams: {
Description: args.options.description || '',
CreationOptions: {
results: [],
Classification: args.options.classification || ''
}
}
}
};
if (args.options.lcid) {
requestOptions.data.optionalParams.CreationOptions.results.push(`SPSiteLanguage:${args.options.lcid}`);
}
if (args.options.owners) {
requestOptions.data.optionalParams.Owners = {
results: args.options.owners.split(',').map(o => o.trim())
};
}
}
else {
let siteDesignId = '';
if (args.options.siteDesignId) {
siteDesignId = args.options.siteDesignId;
}
else {
if (args.options.siteDesign) {
switch (args.options.siteDesign) {
case 'Topic':
siteDesignId = '00000000-0000-0000-0000-000000000000';
break;
case 'Showcase':
siteDesignId = '6142d2a0-63a5-4ba0-aede-d9fefca2c767';
break;
case 'Blank':
siteDesignId = 'f6cc5403-0d63-442e-96c0-285923709ffc';
break;
}
}
else {
siteDesignId = '00000000-0000-0000-0000-000000000000';
}
}
requestOptions = {
url: `${spoUrl}/_api/SPSiteManager/Create`,
headers: {
'content-type': 'application/json;odata=nometadata',
accept: 'application/json;odata=nometadata'
},
responseType: 'json',
data: {
request: {
Title: args.options.title,
Url: args.options.url,
ShareByEmailEnabled: args.options.shareByEmailEnabled,
Description: args.options.description || '',
Classification: args.options.classification || '',
WebTemplate: 'SITEPAGEPUBLISHING#0',
SiteDesignId: siteDesignId
}
}
};
if (args.options.lcid) {
requestOptions.data.request.Lcid = args.options.lcid;
}
if (args.options.owners) {
requestOptions.data.request.Owner = args.options.owners;
}
}
const response = await request.post(requestOptions);
if (isTeamSite) {
if (response.ErrorMessage !== null) {
throw response.ErrorMessage;
}
return response.SiteUrl;
}
else {
if (response.SiteStatus !== 2) {
throw 'An error has occurred while creating the site';
}
return response.SiteUrl;
}
}
catch (err) {
this.handleRejectedODataJsonPromise(err);
return;
}
}
async createClassicSite(logger, args) {
try {
this.spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
this.context = await spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
let exists;
if (args.options.removeDeletedSite) {
exists = await this.siteExists(args.options.url, logger);
}
else {
// assume site doesn't exist
exists = false;
}
if (exists) {
if (this.verbose) {
await logger.logToStderr('Site exists in the recycle bin');
}
await this.deleteSiteFromTheRecycleBin(args.options.url, args.options.wait, logger);
}
else {
if (this.verbose) {
await logger.logToStderr('Site not found');
}
}
this.context = await spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
if (this.verbose) {
await logger.logToStderr(`Creating site collection ${args.options.url}...`);
}
const lcid = typeof args.options.lcid === 'number' ? args.options.lcid : 1033;
const storageQuota = typeof args.options.storageQuota === 'number' ? args.options.storageQuota : 100;
const storageQuotaWarningLevel = typeof args.options.storageQuotaWarningLevel === 'number' ? args.options.storageQuotaWarningLevel : 100;
const resourceQuota = typeof args.options.resourceQuota === 'number' ? args.options.resourceQuota : 0;
const resourceQuotaWarningLevel = typeof args.options.resourceQuotaWarningLevel === 'number' ? args.options.resourceQuotaWarningLevel : 0;
const webTemplate = args.options.webTemplate || 'STS#0';
const requestOptions = {
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
headers: {
'X-RequestDigest': this.context.FormDigestValue
},
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.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">${formatting.escapeXml(args.options.owners)}</Property><Property Name="StorageMaximumLevel" Type="Int64">${storageQuota}</Property><Property Name="StorageWarningLevel" Type="Int64">${storageQuotaWarningLevel}</Property><Property Name="Template" Type="String">${formatting.escapeXml(webTemplate)}</Property><Property Name="TimeZoneId" Type="Int32">${args.options.timeZone}</Property><Property Name="Title" Type="String">${formatting.escapeXml(args.options.title)}</Property><Property Name="Url" Type="String">${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>`
};
const response = await request.post(requestOptions);
const json = JSON.parse(response);
const responseContent = json[0];
if (responseContent.ErrorInfo) {
throw responseContent.ErrorInfo.ErrorMessage;
}
const operation = json[json.length - 1];
const isComplete = operation.IsComplete;
if ((!args.options.wait && !args.options.withAppCatalog) || isComplete) {
return args.options.url;
}
await setTimeout(operation.PollingInterval);
await spo.waitUntilFinished({
operationId: JSON.stringify(operation._ObjectIdentity_),
siteUrl: this.spoAdminUrl,
logger,
currentContext: this.context,
verbose: this.verbose,
debug: this.debug
});
return args.options.url;
}
catch (err) {
this.handleRejectedPromise(err);
return;
}
}
async siteExists(url, logger) {
this.context = await spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
if (this.verbose) {
await logger.logToStderr(`Checking if the site ${url} exists...`);
}
const requestOptions = {
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
headers: {
'X-RequestDigest': this.context.FormDigestValue
},
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.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">${formatting.escapeXml(url)}</Parameter><Parameter Type="Boolean">false</Parameter></Parameters></Method></ObjectPaths></Request>`
};
const response = await request.post(requestOptions);
const json = JSON.parse(response);
const responseContent = json[0];
if (responseContent.ErrorInfo) {
if (responseContent.ErrorInfo.ErrorTypeName === 'Microsoft.Online.SharePoint.Common.SpoNoSiteException') {
return await this.siteExistsInTheRecycleBin(url, logger);
}
throw responseContent.ErrorInfo.ErrorMessage;
}
else {
const site = json[json.length - 1];
return site.Status === 'Recycled';
}
}
async siteExistsInTheRecycleBin(url, logger) {
if (this.verbose) {
await logger.logToStderr(`Site doesn't exist. Checking if the site ${url} exists in the recycle bin...`);
}
const requestOptions = {
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
headers: {
'X-RequestDigest': this.context.FormDigestValue
},
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.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">${formatting.escapeXml(url)}</Parameter></Parameters></Method><Constructor Id="175" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
};
const res = await request.post(requestOptions);
const json = JSON.parse(res);
const response = json[0];
if (response.ErrorInfo) {
if (response.ErrorInfo.ErrorTypeName === 'Microsoft.SharePoint.Client.UnknownError') {
return false;
}
throw response.ErrorInfo.ErrorMessage;
}
const site = json[json.length - 1];
return site.Status === 'Recycled';
}
async deleteSiteFromTheRecycleBin(url, wait, logger) {
this.context = await spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
if (this.verbose) {
await logger.logToStderr(`Deleting site ${url} from the recycle bin...`);
}
const requestOptions = {
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
headers: {
'X-RequestDigest': this.context.FormDigestValue
},
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.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">${formatting.escapeXml(url)}</Parameter></Parameters></Method><Constructor Id="175" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /></ObjectPaths></Request>`
};
const response = await request.post(requestOptions);
const json = JSON.parse(response);
const responseContent = json[0];
if (responseContent.ErrorInfo) {
throw responseContent.ErrorInfo.ErrorMessage;
}
const operation = json[json.length - 1];
const isComplete = operation.IsComplete;
if (!wait || isComplete) {
return;
}
await setTimeout(operation.PollingInterval);
await spo.waitUntilFinished({
operationId: JSON.stringify(operation._ObjectIdentity_),
siteUrl: this.spoAdminUrl,
logger,
currentContext: this.context,
verbose: this.verbose,
debug: this.debug
});
}
async addAppCatalog(url, logger) {
try {
this.spoAdminUrl = await spo.getSpoAdminUrl(logger, this.debug);
this.context = await spo.ensureFormDigest(this.spoAdminUrl, logger, this.context, this.debug);
if (this.verbose) {
await logger.logToStderr(`Adding site collection app catalog...`);
}
const requestOptions = {
url: `${this.spoAdminUrl}/_vti_bin/client.svc/ProcessQuery`,
headers: {
'X-RequestDigest': this.context.FormDigestValue
},
data: `<Request AddExpandoFieldTypeSuffix="true" SchemaVersion="15.0.0.0" LibraryVersion="16.0.0.0" ApplicationName="${config.applicationName}" xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009"><Actions><ObjectPath Id="38" ObjectPathId="37" /><ObjectPath Id="40" ObjectPathId="39" /><ObjectPath Id="42" ObjectPathId="41" /><ObjectPath Id="44" ObjectPathId="43" /><ObjectPath Id="46" ObjectPathId="45" /><ObjectPath Id="48" ObjectPathId="47" /></Actions><ObjectPaths><Constructor Id="37" TypeId="{268004ae-ef6b-4e9b-8425-127220d84719}" /><Method Id="39" ParentId="37" Name="GetSiteByUrl"><Parameters><Parameter Type="String">${formatting.escapeXml(url)}</Parameter></Parameters></Method><Property Id="41" ParentId="39" Name="RootWeb" /><Property Id="43" ParentId="41" Name="TenantAppCatalog" /><Property Id="45" ParentId="43" Name="SiteCollectionAppCatalogsSites" /><Method Id="47" ParentId="45" Name="Add"><Parameters><Parameter Type="String">${formatting.escapeXml(url)}</Parameter></Parameters></Method></ObjectPaths></Request>`
};
const response = await request.post(requestOptions);
const json = JSON.parse(response);
const responseContents = json[0];
if (responseContents.ErrorInfo) {
throw responseContents.ErrorInfo.ErrorMessage;
}
if (this.verbose) {
await logger.logToStderr('Site collection app catalog created');
}
}
catch (err) {
this.handleRejectedPromise(err);
}
}
}
_SpoSiteAddCommand_instances = new WeakSet(), _SpoSiteAddCommand_initTelemetry = function _SpoSiteAddCommand_initTelemetry() {
this.telemetry.push((args) => {
const telemetryProps = {};
const isClassicSite = args.options.type === 'ClassicSite';
const isCommunicationSite = args.options.type === 'CommunicationSite';
telemetryProps.siteType = args.options.type || 'TeamSite';
telemetryProps.description = (!(!args.options.description)).toString();
telemetryProps.classification = (!(!args.options.classification)).toString();
telemetryProps.isPublic = args.options.isPublic || false;
telemetryProps.lcid = args.options.lcid;
telemetryProps.owners = typeof args.options.owners !== 'undefined';
telemetryProps.withAppCatalog = args.options.withAppCatalog || false;
if (isCommunicationSite) {
telemetryProps.shareByEmailEnabled = args.options.shareByEmailEnabled || false;
telemetryProps.siteDesign = args.options.siteDesign;
telemetryProps.siteDesignId = (!(!args.options.siteDesignId)).toString();
}
else if (isClassicSite) {
telemetryProps.webTemplate = typeof args.options.webTemplate !== 'undefined';
telemetryProps.resourceQuota = typeof args.options.resourceQuota !== 'undefined';
telemetryProps.resourceQuotaWarningLevel = typeof args.options.resourceQuotaWarningLevel !== 'undefined';
telemetryProps.storageQuota = typeof args.options.storageQuota !== 'undefined';
telemetryProps.storageQuotaWarningLevel = typeof args.options.storageQuotaWarningLevel !== 'undefined';
telemetryProps.removeDeletedSite = args.options.removeDeletedSite;
telemetryProps.wait = args.options.wait;
}
Object.assign(this.telemetryProperties, telemetryProps);
});
}, _SpoSiteAddCommand_initOptions = function _SpoSiteAddCommand_initOptions() {
this.options.unshift({
option: '--type [type]',
autocomplete: ['TeamSite', 'CommunicationSite', 'ClassicSite']
}, {
option: '-t, --title <title>'
}, {
option: '-a, --alias [alias]'
}, {
option: '-u, --url [url]'
}, {
option: '-z, --timeZone [timeZone]'
}, {
option: '-d, --description [description]'
}, {
option: '-l, --lcid [lcid]'
}, {
option: '--owners [owners]'
}, {
option: '--isPublic'
}, {
option: '-c, --classification [classification]'
}, {
option: '--siteDesign [siteDesign]',
autocomplete: ['Topic', 'Showcase', 'Blank']
}, {
option: '--siteDesignId [siteDesignId]'
}, {
option: '--shareByEmailEnabled'
}, {
option: '-w, --webTemplate [webTemplate]'
}, {
option: '--resourceQuota [resourceQuota]'
}, {
option: '--resourceQuotaWarningLevel [resourceQuotaWarningLevel]'
}, {
option: '--storageQuota [storageQuota]'
}, {
option: '--storageQuotaWarningLevel [storageQuotaWarningLevel]'
}, {
option: '--removeDeletedSite'
}, {
option: '--withAppCatalog'
}, {
option: '--wait'
});
}, _SpoSiteAddCommand_initValidators = function _SpoSiteAddCommand_initValidators() {
this.validators.push(async (args) => {
const isClassicSite = args.options.type === 'ClassicSite';
const isCommunicationSite = args.options.type === 'CommunicationSite';
const isTeamSite = isCommunicationSite === false && isClassicSite === false;
if (args.options.type) {
if (args.options.type !== 'TeamSite' &&
args.options.type !== 'CommunicationSite' &&
args.options.type !== 'ClassicSite') {
return `${args.options.type} is not a valid site type. Allowed types are TeamSite, CommunicationSite, and ClassicSite`;
}
}
if (isTeamSite) {
if (!args.options.alias) {
return 'Required option alias missing';
}
if (args.options.url || args.options.siteDesign || args.options.removeDeletedSite || args.options.wait || args.options.shareByEmailEnabled || args.options.siteDesignId || args.options.timeZone || args.options.resourceQuota || args.options.resourceQuotaWarningLevel || args.options.storageQuota || args.options.storageQuotaWarningLevel || args.options.webTemplate) {
return "Type TeamSite supports only the parameters title, lcid, alias, owners, classification, isPublic, and description";
}
}
else if (isCommunicationSite) {
if (!args.options.url) {
return 'Required option url missing';
}
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.url);
if (isValidSharePointUrl !== true) {
return isValidSharePointUrl;
}
if (args.options.siteDesign) {
if (args.options.siteDesign !== 'Topic' &&
args.options.siteDesign !== 'Showcase' &&
args.options.siteDesign !== 'Blank') {
return `${args.options.siteDesign} is not a valid communication site type. Allowed types are Topic, Showcase and Blank`;
}
}
if (args.options.owners && args.options.owners.indexOf(",") > -1) {
return 'The CommunicationSite supports only one owner in the owners option';
}
if (args.options.siteDesignId) {
if (!validation.isValidGuid(args.options.siteDesignId)) {
return `${args.options.siteDesignId} is not a valid GUID`;
}
}
if (args.options.siteDesign && args.options.siteDesignId) {
return 'Specify siteDesign or siteDesignId but not both';
}
if (args.options.timeZone || args.options.isPublic || args.options.removeDeletedSite || args.options.wait || args.options.alias || args.options.resourceQuota || args.options.resourceQuotaWarningLevel || args.options.storageQuota || args.options.storageQuotaWarningLevel || args.options.webTemplate) {
return "Type CommunicationSite supports only the parameters url, title, lcid, classification, siteDesign, shareByEmailEnabled, siteDesignId, owners, and description";
}
}
else {
if (!args.options.url) {
return 'Required option url missing';
}
const isValidSharePointUrl = validation.isValidSharePointUrl(args.options.url);
if (isValidSharePointUrl !== true) {
return isValidSharePointUrl;
}
if (!args.options.owners) {
return 'Required option owner missing';
}
if (args.options.owners.indexOf(",") > -1) {
return 'The ClassicSite supports only one owner in the owners options';
}
if (!args.options.timeZone) {
return 'Required option timeZone missing';
}
if (typeof args.options.timeZone !== 'number') {
return `${args.options.timeZone} is not a number`;
}
if (args.options.resourceQuota &&
typeof args.options.resourceQuota !== 'number') {
return `${args.options.resourceQuota} is not a number`;
}
if (args.options.resourceQuotaWarningLevel &&
typeof args.options.resourceQuotaWarningLevel !== 'number') {
return `${args.options.resourceQuotaWarningLevel} is not a number`;
}
if (args.options.resourceQuotaWarningLevel &&
!args.options.resourceQuota) {
return `You cannot specify resourceQuotaWarningLevel without specifying resourceQuota`;
}
if (args.options.resourceQuotaWarningLevel > args.options.resourceQuota) {
return `resourceQuotaWarningLevel cannot exceed resourceQuota`;
}
if (args.options.storageQuota &&
typeof args.options.storageQuota !== 'number') {
return `${args.options.storageQuota} is not a number`;
}
if (args.options.storageQuotaWarningLevel &&
typeof args.options.storageQuotaWarningLevel !== 'number') {
return `${args.options.storageQuotaWarningLevel} is not a number`;
}
if (args.options.storageQuotaWarningLevel &&
!args.options.storageQuota) {
return `You cannot specify storageQuotaWarningLevel without specifying storageQuota`;
}
if (args.options.storageQuotaWarningLevel > args.options.storageQuota) {
return `storageQuotaWarningLevel cannot exceed storageQuota`;
}
if (args.options.classification || args.options.shareByEmailEnabled || args.options.siteDesignId || args.options.siteDesignId || args.options.alias || args.options.isPublic) {
return "Type ClassicSite supports only the parameters url, title, lcid, storageQuota, storageQuotaWarningLevel, resourceQuota, resourceQuotaWarningLevel, webTemplate, owners, and description";
}
}
if (args.options.lcid) {
if (isNaN(args.options.lcid)) {
return `${args.options.lcid} is not a number`;
}
if (args.options.lcid < 0) {
return `LCID must be greater than 0 (${args.options.lcid})`;
}
if (this.supportedLcids.indexOf(args.options.lcid) < 0) {
return `LCID ${args.options.lcid} is not valid. See https://support.microsoft.com/en-us/office/languages-supported-by-sharepoint-dfbf3652-2902-4809-be21-9080b6512fff for the languages supported by SharePoint.`;
}
}
return true;
});
};
export default new SpoSiteAddCommand();
//# sourceMappingURL=site-add.js.map