示例#1
0
 public override void DeploySiteModel(ModelNode model)
 {
     WithSSOMContext((site, web) =>
     {
         _provisionService.DeployModel(SiteModelHost.FromSite(site), model);
         _validationService.DeployModel(SiteModelHost.FromSite(site), model);
     });
 }
示例#2
0
 public override void DeployFarmModel(ModelNode model)
 {
     for (var provisionGeneration = 0; provisionGeneration < ProvisionGenerationCount; provisionGeneration++)
     {
         WithSSOMFarmContext(farm =>
         {
             _provisionService.DeployModel(FarmModelHost.FromFarm(farm), model);
             _validationService.DeployModel(FarmModelHost.FromFarm(farm), model);
         });
     }
 }
示例#3
0
        static void Main(string[] args)
        {
            // Step 1, define site field
            var customerField = new FieldDefinition
            {
                Id           = new Guid("26470917-fbbf-413b-9eb3-537f74797e4e"),
                Title        = "Customer Name",
                InternalName = "cstm_CustomerName",
                Description  = "Name of the target customer.",
                Group        = "Hello SPMeta2",
                FieldType    = BuiltInFieldTypes.Text
            };

            // Step 2, define site model and artifact relationships - add field to the site
            var siteModel = SPMeta2Model
                            .NewSiteModel(site =>
            {
                site.AddField(customerField);
            });

            // Step 3, deploy model via CSOM
            using (var clientContext = new ClientContext(SampleConsts.CSOM_SiteUrl))
            {
                var csomProvisionService = new CSOMProvisionService();
                csomProvisionService.DeployModel(SPMeta2.CSOM.ModelHosts.SiteModelHost.FromClientContext(clientContext), siteModel);
            }

            // Step 4, deploy model via SSOM
            using (var site = new SPSite(SampleConsts.SSOM_SiteUrl))
            {
                var csomProvisionService = new SSOMProvisionService();
                csomProvisionService.DeployModel(SPMeta2.SSOM.ModelHosts.SiteModelHost.FromSite(site), siteModel);
            }
        }
 protected void DeploySiteModelAsSSOM(ModelNode model)
 {
     using (var site = new SPSite(SampleConsts.SSOM_SiteUrl))
     {
         var ssomProvisionService = new SSOMProvisionService();
         ssomProvisionService.DeployModel(SPMeta2.SSOM.ModelHosts.SiteModelHost.FromSite(site), model);
     }
 }
 protected void DeployWebModelAsSSOM(ModelNode model)
 {
     using (var site = new SPSite(SampleConsts.SSOM_SiteUrl))
     {
         using (var web = site.OpenWeb())
         {
             var ssomProvisionService = new SSOMProvisionService();
             ssomProvisionService.DeployModel(SPMeta2.SSOM.ModelHosts.WebModelHost.FromWeb(web), model);
         }
     }
 }