private static void CheckPageCountValue(this SiteToolOptions option) { if (option.Section == 0) { option.Section = 10; } }
private static void CheckUserNameValue(this SiteToolOptions option) { if (string.IsNullOrEmpty(option.UserName)) { logger.Info("please input user name:"); option.UserName = Console.ReadLine(); } }
private static void CheckAdminUrlValue(this SiteToolOptions option) { if (string.IsNullOrEmpty(option.AdminUrl)) { logger.Info("please input admin site url:"); option.AdminUrl = Console.ReadLine(); } }
private static void CheckCountValue(this SiteToolOptions option) { if (option.Count == 0) { logger.Info("please input create group count:"); option.Count = int.Parse(Console.ReadLine()); } }
private static void CheckTemplateValue(this SiteToolOptions option) { if (string.IsNullOrEmpty(option.Template)) { logger.Info("please input site collection template:"); option.Template = Console.ReadLine(); } }
private static void CheckPasswordValue(this SiteToolOptions option) { if (string.IsNullOrEmpty(option.Password)) { logger.Info("please input user password :"); option.Password = Console.ReadLine(); } }
public static void CheckArguement(this SiteToolOptions option) { option.CheckAdminUrlValue(); option.CheckCountValue(); option.CheckPasswordValue(); option.CheckUrlValue(); option.CheckUserNameValue(); option.CheckTemplateValue(); option.CheckPageCountValue(); }
public static void CreateMultipleSiteCollections(SiteToolOptions option) { var context = tokenHelper.GetClientContextForServiceAccount(option.AdminUrl, option.UserName, option.Password); context.RequestTimeout = 6000 * 1000; Tenant tenant = new Tenant(context); var creatingSites = new List <string>(); for (int index = 1; index <= option.Count; index++) { var siteUrl = option.Url + index.ToString(); if (IsSiteExist(context, tenant, siteUrl)) { logger.Info($"{0} aleady exist in tenant"); continue; } SpoOperation ope = tenant.CreateSite( new SiteCreationProperties() { CompatibilityLevel = 15, Lcid = 1033, Owner = option.UserName, Template = option.Template, TimeZoneId = 45, Title = "", Url = siteUrl, StorageMaximumLevel = 0, UserCodeMaximumLevel = 0, UserCodeWarningLevel = Math.Floor(0 * 0.85), StorageWarningLevel = (long)Math.Floor(0 * 0.85) }); context.Load(ope); context.ExecuteQuery(); creatingSites.Add(siteUrl); if (creatingSites.Count >= option.Section) { WaitSiteCreateFinished(context, tenant, creatingSites); creatingSites.Clear(); } } WaitSiteCreateFinished(context, tenant, creatingSites); }