ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Core Namespace / ApplicationOptions Class / GeoprocessingOptions Property
Example Version

GeoprocessingOptions Property
Gets the available application geoprocessing options.
Syntax
public static GeoprocessingOptions GeoprocessingOptions {get;}
Example
Get GeoprocessingOptions
//These options are for behavior of interactive GP tools _only_.

var overwrite_gp = ApplicationOptions.GeoprocessingOptions.OverwriteExistingDatasets;
var remove_gp = ApplicationOptions.GeoprocessingOptions.RemoveOverwrittenLayers;
var addoutput_gp = ApplicationOptions.GeoprocessingOptions.AddOutputDatasetsToOpenMap;
var history_gp = ApplicationOptions.GeoprocessingOptions.WriteGPOperationsToHistory;
Set GeoprocessingOptions
//Note: changing these options modifies behavior of interactive GP tools _only_.
//Use the ArcGIS.Desktop.Core.Geoprocessing.GPExecuteToolFlags enum parameter
//to modify the behavior of Geoprocessing.ExecuteToolAsync(...)

//Note: setting GeoprocessingOptions requires the QueuedTask
QueuedTask.Run(() =>
{
  ApplicationOptions.GeoprocessingOptions.SetOverwriteExistingDatasets(true);
  ApplicationOptions.GeoprocessingOptions.SetRemoveOverwrittenLayers(false);
  ApplicationOptions.GeoprocessingOptions.SetAddOutputDatasetsToOpenMap(true);
  ApplicationOptions.GeoprocessingOptions.SetWriteGPOperationsToHistory(false);
});
Requirements

Target Platforms: Windows 11, Windows 10

ArcGIS Pro version: 3 or higher.
See Also