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); } }
public static void DeployListModel(this SSOMProvisionService modelHost, SPList list, ModelNode model) { var listHost = ModelHostBase.Inherit <ListModelHost>(WebModelHost.FromWeb(list.ParentWeb), h => { h.HostList = list; }); modelHost.DeployModel(listHost, 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); } } }
public static void DeployWebModel(this SSOMProvisionService modelHost, SPWeb web, ModelNode model) { modelHost.DeployModel(WebModelHost.FromWeb(web), model); }
public static void DeploySiteModel(this SSOMProvisionService modelHost, SPSite site, ModelNode model) { modelHost.DeployModel(SiteModelHost.FromSite(site), model); }
public static void DeployWebApplicationModel(this SSOMProvisionService modelHost, SPWebApplication webApplication, ModelNode model) { modelHost.DeployModel(WebApplicationModelHost.FromWebApplication(webApplication), model); }
public static void DeployFarmModel(this SSOMProvisionService modelHost, SPFarm farm, ModelNode model) { modelHost.DeployModel(FarmModelHost.FromFarm(farm), model); }