示例#1
0
        public void CreateSiteColumnsAndContentTypes()
        {
            ConfigureSites(true, "activating content type dependency features");
            Console.WriteLine("Starting setup of site columns and content types");

            using (var context = new ClientContext(_urlToSite))
            {
                context.Credentials = _credentials;
                foreach (var file in Directory.GetFiles(ConfigurationDirectoryPath, "*fields.json", SearchOption.AllDirectories))
                {
                    var siteColumnPersister = new FilePersistanceProvider <List <GtField> >(file);
                    var siteColumnManager   = new FieldManager(context, siteColumnPersister.Load());
                    siteColumnManager.CreateSiteColumns();
                }
                foreach (var file in Directory.GetFiles(ConfigurationDirectoryPath, "*contenttypes.json", SearchOption.AllDirectories))
                {
                    var contentTypePersister = new FilePersistanceProvider <List <GtContentType> >(file);
                    var contentTypeManager   = new ContentTypeManager(context, contentTypePersister.Load());
                    contentTypeManager.CreateContentTypes();
                }
            }
            Console.WriteLine("Done setup of site columns and content types");
        }