Select to view content in your preferred language

How to call a Geoprocessing Service using Pro SDK from a custom button

225
2
03-18-2025 05:43 PM
EstherSmith_Dev
Regular Contributor

Hi all,

I have a need to call a Geoprocessing service when user clicks a button, wait for the result and show the results. The geoprocessing service is published to a federated server and I can see it in ArcGIS Pro UI's Catalog pane under Portal panel and I can execute it successfully using Pro UI.

I want to do the same programmatically when user click a custom button.

I can see a ArcGIS.Desktop.Core.Geoprocessing.Geoprocessing class and has

ExecuteToolAsync

But it seems to only take the tool name/path as a parameter and not sure if I can pass portal item or a GPServer tool. All examples and snippets in online documentation point to standard tool or a tool from a toolbox. Can someone share a code snippet on calling a GP Service in Pro SDK?

I am trying to avoid making a REST call using http and wait for the jobStatus etc and trying to remain within Pro SDK classes.   

Thanks,

 

 

Tags (1)
0 Kudos
2 Replies
SelimDissem
Esri Contributor

Hi Esther,

See in ProConcepts Geoprocessing · Esri/arcgis-pro-sdk Wiki · GitHub how to call a Geoprocessing service in Pro

 

0 Kudos
EstherSmith_Dev
Regular Contributor

Thanks @SelimDissem 

My ArcGIS server is a federated server. Do I still need to have ArcGIS Server connection file created? Is it possible to generate AGS file on-the-fly using current Active Portal e.g. ArcGISPortalManager.Current.GetActivePortal() ?

 

 

0 Kudos