コード例 #1
0
 private static void CheckPageCountValue(this SiteToolOptions option)
 {
     if (option.Section == 0)
     {
         option.Section = 10;
     }
 }
コード例 #2
0
 private static void CheckUserNameValue(this SiteToolOptions option)
 {
     if (string.IsNullOrEmpty(option.UserName))
     {
         logger.Info("please input user name:");
         option.UserName = Console.ReadLine();
     }
 }
コード例 #3
0
 private static void CheckAdminUrlValue(this SiteToolOptions option)
 {
     if (string.IsNullOrEmpty(option.AdminUrl))
     {
         logger.Info("please input admin site url:");
         option.AdminUrl = Console.ReadLine();
     }
 }
コード例 #4
0
 private static void CheckCountValue(this SiteToolOptions option)
 {
     if (option.Count == 0)
     {
         logger.Info("please input create group count:");
         option.Count = int.Parse(Console.ReadLine());
     }
 }
コード例 #5
0
 private static void CheckTemplateValue(this SiteToolOptions option)
 {
     if (string.IsNullOrEmpty(option.Template))
     {
         logger.Info("please input site collection template:");
         option.Template = Console.ReadLine();
     }
 }
コード例 #6
0
 private static void CheckPasswordValue(this SiteToolOptions option)
 {
     if (string.IsNullOrEmpty(option.Password))
     {
         logger.Info("please input user password :");
         option.Password = Console.ReadLine();
     }
 }
コード例 #7
0
 public static void CheckArguement(this SiteToolOptions option)
 {
     option.CheckAdminUrlValue();
     option.CheckCountValue();
     option.CheckPasswordValue();
     option.CheckUrlValue();
     option.CheckUserNameValue();
     option.CheckTemplateValue();
     option.CheckPageCountValue();
 }
コード例 #8
0
ファイル: SiteTool.cs プロジェクト: lulzzz/SharePointAPI
        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);
        }