/// <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, ShWeb configWeb) { var webToConfigure = EnsureWeb(context, parentWeb, configWeb); FeatureManager.ActivateWebFeatures(context, webToConfigure, configWeb.WebFeatures); ListManager.CreateLists(context, webToConfigure, configWeb.Lists); QuicklaunchManager.CreateQuicklaunchNodes(context, webToConfigure, configWeb.Quicklaunch); PropertyManager.SetProperties(context, webToConfigure, configWeb.Properties); ContentUploadManager.UploadFilesInFolder(context, webToConfigure, configWeb.ContentFolders); SetWelcomePageUrlIfConfigured(context, webToConfigure, configWeb); foreach (ShWeb subWeb in configWeb.Webs) { EnsureAndConfigureWebAndActivateFeatures(context, webToConfigure, subWeb); } }
/// <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, ShWeb configWeb) { var webToConfigure = EnsureWeb(context, parentWeb, configWeb); ListManager.CreateLists(context, webToConfigure, configWeb.Lists); FeatureManager.ActivateWebFeatures(context, webToConfigure, configWeb.WebFeatures); QuicklaunchManager.CreateQuicklaunchNodes(context, webToConfigure, configWeb.Quicklaunch); PropertyManager.SetProperties(context, webToConfigure, configWeb.Properties); ContentUploadManager.UploadFilesInFolder(context, webToConfigure, configWeb.ContentFolders, IncrementalUpload); ComposedLookManager.SetComposedLook(context, configWeb, webToConfigure, configWeb.ComposedLook); SearchNavigationManager.CreateSearchNavigationNodes(context, webToConfigure, configWeb.SearchNavigation); SetWelcomePageUrlIfConfigured(context, webToConfigure, configWeb); SetAlternateCssUrlForWeb(context, configWeb, webToConfigure); foreach (ShWeb subWeb in configWeb.Webs) { EnsureAndConfigureWebAndActivateFeatures(context, webToConfigure, subWeb); } }
/// <summary> /// Will only activate site collection features or rootweb's web features /// </summary> public void ActivateContentTypeDependencyFeatures() { FeatureManager.ActivateSiteCollectionFeatures(ClientContext, ConfigurationSiteCollection.SiteFeatures, true); FeatureManager.ActivateWebFeatures(ClientContext, ClientContext.Web, ConfigurationSiteCollection.RootWeb.WebFeatures, true); }