Geoprocessing Environment Variables

656
3
12-30-2021 03:12 AM
AnupamKumar
New Contributor

I have gone through the API and samples. But could not find how to set the geoprocessing environment variables Maintain Attachments & Preserve Global IDs using Geoprocessing.MakeEnvironmentArray using ArcGIS Pro SDK. I am calling Append Geoprocessing Tool from ArcGIS Pro SDK. Geoprocessing.MakeEnvironmentArray does not have the KeyValuePair.

0 Kudos
3 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

You can set them like that:

var env = Geoprocessing.MakeEnvironmentArray(maintainAttachments: "True", 
preserveGlobalIds: "True");

Name for each setting you can find here:

https://pro.arcgis.com/en/pro-app/latest/tool-reference/environment-settings/an-overview-of-geoproce... 

0 Kudos
AnupamKumar
New Contributor

Geoprocessing.MakeEnvironmentArray does not have KeyValuePair for maintainAttachments & preserveGlobalIds in ArcGIS Pro SDK. Attached is the snap shot for reference. Will these variables would be included in future releases.

0 Kudos
GKmieliauskas
Esri Regular Contributor

Sorry, I have not checked existing of parameters.

Have you checked like this:

                List<KeyValuePair<string, string>> env1 = new List<KeyValuePair<string, string>>();
                env1.Add(new KeyValuePair<string, string>("maintainAttachments", "True"));
                env1.Add(new KeyValuePair<string, string>("preserveGlobalIds", "True"));

If you have to set other parameters, you can cast MakeEnvironmentArray result to List and then add additional values.

0 Kudos