I hesitate to submit this, as the syntax for calling this geoprocessing tool from the Pro SDK would seem straight forward. The geoprocessing tool in Pro only appears to require an input feature layer to run. I have successfully navigated calling many other geoprocessing tools much more involved than this, so I did not anticipate any heartburn with this one.
However, I have not been able to have it successfully execute. I am using the same basic pattern as with other geoprocessing tools. I have tried many versions of this pattern, assigning values to the env array and trying different values for the arguments (strings of paths to the feature class, output feature layers, etc) with no luck. The feature layer passed in is a point feature class in a file geodatabase. I can successfully run the tool in native pro on the feature layer with success.
<SPAN class="keyword token">public</SPAN> Task<SPAN class="operator token"><</SPAN>IGPResult<SPAN class="operator token">></SPAN> <SPAN class="token function">AddXYCoordinate4</SPAN><SPAN class="punctuation token">(</SPAN>FeatureLayer featureLayer<SPAN class="punctuation token">)</SPAN>
<SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> AddXY <SPAN class="operator token">=</SPAN> <SPAN class="string token">@"C:\Program Files\ArcGIS\Pro\Resources\ArcToolBox\Toolboxes\Data Management Tools.tbx\Add XY Coordinates"</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> args <SPAN class="operator token">=</SPAN> Geoprocessing<SPAN class="punctuation token">.</SPAN><SPAN class="token function">MakeValueArray</SPAN><SPAN class="punctuation token">(</SPAN>featureLayer<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> env <SPAN class="operator token">=</SPAN> Geoprocessing<SPAN class="punctuation token">.</SPAN><SPAN class="token function">MakeEnvironmentArray</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> Geoprocessing<SPAN class="punctuation token">.</SPAN><SPAN class="token function">ExecuteToolAsync</SPAN><SPAN class="punctuation token">(</SPAN>AddXY<SPAN class="punctuation token">,</SPAN> args<SPAN class="punctuation token">,</SPAN> env<SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="keyword token">null</SPAN><SPAN class="punctuation token">,</SPAN> GPExecuteToolFlags<SPAN class="punctuation token">.</SPAN>None<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>I would appreciate it if anyone could kindly assist me with how this tool should be called.
Thanks