コード例 #1
0
        public string CreateSiteCollection(ClientContext context)
        {
            string creatingStatus = string.Empty;

            switch (CSOMUtil.GetSiteCollectionStatusByUrl(context, AppSettings.DemoSiteCollectionUrl))
            {
            case "Active":
                creatingStatus = "created";
                break;

            case "Creating":
                creatingStatus = "creating";
                break;

            case "None":
                try
                {
                    creatingStatus = "creating";
                    CSOMUtil.CreateSiteCollection(context, new SiteCreationProperties
                    {
                        Url                  = AppSettings.DemoSiteCollectionUrl,
                        Owner                = AppSettings.DemoSiteCollectionOwner,
                        Template             = "BLANKINTERNETCONTAINER#0",
                        Title                = "Contoso Property Management Dashboard",
                        StorageMaximumLevel  = 1000,
                        StorageWarningLevel  = 750,
                        TimeZoneId           = 7,
                        UserCodeMaximumLevel = 1000,
                        UserCodeWarningLevel = 500
                    });
                }
                catch
                {
                    creatingStatus = "fail";
                }
                break;
            }

            return(creatingStatus);
        }