Exemple #1
0
        public SiteSetupManager(ClientContext clientContext, GtWeb configurationWeb)
        {
            _configurationWeb = configurationWeb;
            ClientContext     = clientContext;

            FeatureManager     = new FeatureManager();
            QuicklaunchManager = new QuicklaunchManager();
            PropertyManager    = new PropertyManager();
            ListManager        = new ListManager();
        }
Exemple #2
0
 private WebCreationInformation GetWebCreationInformationFromConfig(GtWeb configWeb)
 {
     return(new WebCreationInformation
     {
         Title = configWeb.Name,
         Description = configWeb.Description,
         Language = configWeb.Language,
         Url = configWeb.Url,
         UseSamePermissionsAsParentSite = true,
         WebTemplate = configWeb.Template
     });
 }
Exemple #3
0
        private Web EnsureWeb(ClientContext context, Web parentWeb, GtWeb configWeb)
        {
            Web webToConfigure;

            if (parentWeb == null)
            {
                //We assume that the root web always exists
                webToConfigure = context.Site.RootWeb;
            }
            else
            {
                webToConfigure = GetSubWeb(context, parentWeb, configWeb.Url);

                if (webToConfigure == null)
                {
                    Console.WriteLine("Creating web " + configWeb.Url);
                    webToConfigure = parentWeb.Webs.Add(GetWebCreationInformationFromConfig(configWeb));
                }
            }
            context.Load(webToConfigure, w => w.Url);
            context.ExecuteQuery();

            return(webToConfigure);
        }
Exemple #4
0
        /// <summary>
        /// Assumptions:
        /// 1. The order of webs and subwebs in the config file follows the structure of SharePoint sites
        /// 2. No config element is present without their parent web already being defined in the config file, except the root web
        /// </summary>
        private void EnsureAndConfigureWebAndActivateFeatures(ClientContext context, Web parentWeb, GtWeb configWeb)
        {
            var webToConfigure = EnsureWeb(context, parentWeb, configWeb);

            FeatureManager.ActivateFeatures(context, webToConfigure, configWeb.SiteFeatures, configWeb.WebFeatures);
            ListManager.CreateLists(context, webToConfigure, configWeb.Lists);
            QuicklaunchManager.CreateQuicklaunchNodes(context, webToConfigure, configWeb.Quicklaunch);
            PropertyManager.SetProperties(context, webToConfigure, configWeb.Properties);

            foreach (GtWeb subWeb in configWeb.Webs)
            {
                EnsureAndConfigureWebAndActivateFeatures(context, webToConfigure, subWeb);
            }
        }