예제 #1
0
        private static void DeleteFieldsSpecifiedInFile(ClientContext context, string file)
        {
            Log.Info("Deleting all fields with the same group as the ones in the file " + file);
            var siteColumnPersister = new FilePersistanceProvider <List <ShField> >(file);
            var siteColumnManager   = new FieldManager(context, siteColumnPersister.Load());

            siteColumnManager.DeleteAllCustomFields();
        }
예제 #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");
 }