How to remove a feature class from GeoDB

455
3
07-08-2017 06:11 AM
jackpearson
New Contributor II

I'm adding a feature class to file geodb using :

 GPExecuteToolFlags flags = GPExecuteToolFlags.None; 

 IGPResult result = await Geoprocessing.ExecuteToolAsync("CreateFeatureclass_management", Geoprocessing.MakeValueArray(arguments.ToArray()),null,null,null, flags);     

Q1) : It still seems to also add to the current map - what flag do i need to set to prevent that ?

Q2 ) How can i remove that feature class programmatically from the the geodb ? i cannot find any mention of something like Delete/RemoveFeatureclass_management

Thanks.

0 Kudos
3 Replies
curtvprice
MVP Esteemed Contributor

There is a single tool used to delete objects from the database:

Delete—Data Management toolbox | ArcGIS Desktop 

0 Kudos
jackpearson
New Contributor II

Thanks Curtis - anyone seen a .net equivalent ? I couldn't  find any docco/example.

I imagine something like below, but I can't work out how to specify the geodb ?

what is the equiv of py : arcpy.env.workspace = ...

List<object> argsList = new List<object>() { featureclassNameToDelete };
var args = Geoprocessing.MakeValueArray(argsList.ToArray());
IGPResult result = await Geoprocessing.ExecuteToolAsync("Delete_management", args);

0 Kudos
jackpearson
New Contributor II

Figured this out :

List<object> argsList = new List<object>() { featureclassNameToDelete };
var args = Geoprocessing.MakeValueArray(argsList.ToArray());

var envs = Geoprocessing.MakeEnvironmentArray(workspace : gdbPath);

IGPResult result = await Geoprocessing.ExecuteToolAsync("Delete_management", args, envs);

0 Kudos