public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Document document = commandData.Application.ActiveUIDocument.Document; if (!(StorageUtility.DoesAnyStorageExist(document))) { message = "No storage in this document to delete."; } else { Transaction tErase = new Transaction(document, "Erase EStorage"); tErase.Start(); IList <Schema> schemas = Schema.ListSchemas(); foreach (Schema schema in schemas) { //Note-this will delete storage of this schema in *all* open documents. Schema.EraseSchemaAndAllEntities(schema, true); } tErase.Commit(); message = "All storage was deleted."; } TaskDialog.Show("ExtensibleStorageUtility", message); return(Result.Succeeded); }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Document document = commandData.Application.ActiveUIDocument.Document; string storageElements = StorageUtility.GetElementsWithAllSchemas(document); TaskDialog.Show("ExtensibleStorageUtility", storageElements); return(Result.Succeeded); }
/// <summary> /// Returns a formatted string containing schema guids and element info for all elements /// containing extensible storage. /// </summary> public static string GetElementsWithAllSchemas(Document doc) { StringBuilder sBuilder = new StringBuilder(); IList <Schema> schemas = Schema.ListSchemas(); if (schemas.Count == 0) { return("No schemas or storage."); } else { foreach (Schema schema in schemas) { sBuilder.Append(StorageUtility.GetElementsWithSchema(doc, schema)); } return(sBuilder.ToString()); } }