Example #1
0
        private static void DeleteContentTypesSpecifiedInFile(ClientContext context, string file)
        {
            Log.Info("Deleting all content types with the same group as the ones in the file " + file);
            var contentTypePersister = new FilePersistanceProvider <List <ShContentType> >(file);
            var contentTypeManager   = new ContentTypeManager(context, contentTypePersister.Load());

            contentTypeManager.DeleteAllCustomContentTypes();
        }
Example #2
0
 public void DeleteAllSherpaSiteColumnsAndContentTypes()
 {
     Console.WriteLine("Deleting all Glitterind columns and content types");
     using (var context = new ClientContext(_urlToSite))
     {
         context.Credentials = _credentials;
         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.DeleteAllCustomContentTypes();
         }
         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.DeleteAllCustomFields();
         }
     }
     Console.WriteLine("Done deleting all Glitterind columns and content types");
 }