static void Main(string[] args)
        {
            var siteUrl = "http://portal";
            var o365UserName = "******";
            var o365UserPassword = "******";

            var consoleUtils = new ConsoleUtils();

            consoleUtils.WithO365Context(siteUrl, o365UserName, o365UserPassword, context =>
            {
                // replace it with your M2 models
                var siteModel = default(ModelNode);
                var rotWebModel = default(ModelNode);

                // create a provision service - CSOMProvisionService or StandardCSOMProvisionService
                var provisionService = new CSOMProvisionService();

                // little nice thing, tracing the progress
                consoleUtils.TraceDeploymentProgress(provisionService);

                // deploy!
                provisionService.DeploySiteModel(context, siteModel);
                provisionService.DeployWebModel(context, rotWebModel);
            });
        }
示例#2
0
 static void Main(string[] args)
 {
     var model = GoogleMapsModel.GetModel();
     var siteUrl = "http://dev";
     var context = new ClientContext(siteUrl);
     var provisionService = new CSOMProvisionService();
     provisionService.DeployWebModel(context, model);
 }
示例#3
0
 static void Main(string[] args)
 {
     var siteUrl = "http://dev";
     var context = new ClientContext(siteUrl);
     var provisionService = new CSOMProvisionService();
     var model = GetModel();
     provisionService.DeployWebModel(context, model);
     var model2 = GetModel2();
     var context2 = new ClientContext(siteUrl + "/" + subWebUrl);
     provisionService.DeployWebModel(context2, model2);
 }
        public void CanProvisionIntranet_SiteModel()
        {
            WithCSOMContext(context =>
            {
                var siteModel = new M2ProjectPrefixSiteModel();
                var rootWebModel = new M2ProjectPrefixRootWebModel();

                var provisionService = new CSOMProvisionService();

                // site
                provisionService.DeploySiteModel(context, siteModel.GetSiteFeaturesModel());
                provisionService.DeploySiteModel(context, siteModel.GetUserCustomActionModel());
                provisionService.DeploySiteModel(context, siteModel.GetSiteSecurityModel());

                provisionService.DeploySiteModel(context, siteModel.GetFieldsAndContentTypesModel());
                provisionService.DeploySiteModel(context, siteModel.GetSandboxSolutionsModel());

                // root web
                provisionService.DeployWebModel(context, rootWebModel.GetStyleLibraryModel());
                provisionService.DeployWebModel(context, rootWebModel.GetModel());
            });
        }
示例#5
0
 static void Main(string[] args)
 {
     var siteUrl = "https://staging-nps.skanska.net/sites/jsomtest/tolle";
     var context = new ClientContext(siteUrl);
     var provisionService = new CSOMProvisionService();
     var model = GetModel();
     provisionService.DeployWebModel(context, model);
 }
        public static void Provision(ClientContext context, CSOMProvisionService provisioningService)
        {
            context.Site.EnsureProperties("ServerRelativeUrl");

            // model for Site Collection artifacts for stories
            var rootSiteModel = SPMeta2Model.NewSiteModel(site =>
            {
                site.AddTaxonomyTermStore(
                    new TaxonomyTermStoreDefinition() { UseDefaultSiteCollectionTermStore = true},
                    store =>
                    {
                        store.AddTaxonomyTermGroup(new TaxonomyTermGroupDefinition() {IsSiteCollectionGroup = true},
                            group =>
                            {
                                group.AddTaxonomyTermSet(new TaxonomyTermSetDefinition()
                                {
                                    Name = "SPMETA2Test",
                                    LCID = 1033
                                },
                                    termset =>
                                    {
                                        termset.AddTaxonomyTerm(new TaxonomyTermDefinition() {Name = "testterm", LCID = 1033});
                                    });
                            });
                    }
                    );

            });
            var rootSiteModel2 = SPMeta2Model.NewSiteModel(site =>
            {

                site.AddTaxonomyField(new TaxonomyFieldDefinition()
                {
                    InternalName = "sptaxfieldtest1",
                    Group = "spmeta2test",
                    Title = "TextTaxonomyField",
                    IsSiteCollectionGroup = true,
                    //TermGroupName = "Site Collection - mbakirov367.sharepoint.com",
                    UseDefaultSiteCollectionTermStore = true,
                    TermSetName = "SPMETA2Test",
                    TermSetLCID = 1033,
                    TermName = "testterm",
                    TermLCID = 1033
                }
                    );
            });

            // model for Site Collection artifacts for stories
            var rootWebModel = SPMeta2Model.NewWebModel(web =>
            {

            });

            provisioningService.DeploySiteModel(context, rootSiteModel);
            Thread.Sleep(1000);
            provisioningService.DeploySiteModel(context, rootSiteModel2);
            provisioningService.DeployWebModel(context, rootWebModel);
        }