Exemple #1
0
        protected void DeploySSOMModel(ModelNode model)
        {
            // deploy with SSOM
            var ssomProvisionService = new StandardSSOMProvisionService();

            using (var spSite = new SPSite(SSOMSiteUrl))
            {
                if (model.Value is FarmDefinition)
                {
                    ssomProvisionService.DeployModel(new FarmModelHost(SPFarm.Local), model);
                }

                if (model.Value is WebApplicationDefinition)
                {
                    ssomProvisionService.DeployModel(new WebApplicationModelHost(spSite.WebApplication), model);
                }

                if (model.Value is SiteDefinition)
                {
                    ssomProvisionService.DeploySiteModel(spSite, model);
                }

                if (model.Value is WebDefinition)
                {
                    ssomProvisionService.DeployWebModel(spSite.RootWeb, model);
                }
            }
        }
Exemple #2
0
        public void Deploy_SiteModel_SSOM()
        {
            // setup url
            var siteUrl = "";

            // create you model
            var siteModel = SPMeta2Model.NewSiteModel(site =>
            {
            });

            using (var spSite = new SPSite(siteUrl))
            {
                // deploy site model with SharePoint Foundation SSOM API
                var foundationProvisionService = new SSOMProvisionService();
                foundationProvisionService.DeploySiteModel(spSite, siteModel);

                // deploy site model with SharePoint Standard SSOM API
                var standardProvisionService = new StandardSSOMProvisionService();
                standardProvisionService.DeploySiteModel(spSite, siteModel);
            }
        }