Select to view content in your preferred language

How can I open the tool "Share as Web Layer"

632
4
10-17-2017 11:38 AM
HoriaTudosie
Frequent Contributor

Using ArcGIS Pro 2.0(1) SDK, how can I initiate the command "Share as Web Layer" as I do from the popup menu on the layer from the content dialog:

Also, how can I pre-populate the parameters of the tool:

I need the user just to check and click Publish...

Tags (1)
4 Replies
KristianLarsen1
Emerging Contributor

Any way to access this in 3.x?

0 Kudos
GKmieliauskas
Esri Regular Contributor

Hi,

You can open "New WEB layer" using ID (esri_sharing_SharingAsWEBLayerCXMUBtn)

GKmieliauskas_0-1737442211484.png

var commandId = "esri_sharing_SharingAsWEBLayerCXMUBtn";
IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper(commandId);
var command = wrapper as ICommand; 

if ((command != null) && command.CanExecute(null))
  command.Execute(null);

 

Another way is to open geoprocessing tool dialog using Geoprocessing.OpenToolDialog

 

 

0 Kudos
KristianLarsen1
Emerging Contributor

Hi and thanks for the swift help!

I'm using the 3.2 SDK, and i can't get any of these to work.
Command is null, and OpenToolDialog returns "tool not found".

Is there any documentation available for the "esri_sharing_SharingAsWEBLayerCXMUBtn" command?

Right now i'm calling a share script from a py toolbox using Geoprocessing.ExecuteToolAsync, but i really don't want to rewrite the whole shareAsWebLayer dialog.. So the idea is to do some checks, filtering, metadata and database-stuff before passing the args to the shareAsWebLayer tool.

0 Kudos
KristianLarsen1
Emerging Contributor

ICommand.Execute didn't work because i had no selected layer, or the layer selected was not the correct type. Still it only opens the dialog, i guess it doesn't support args..

Some documentation for this would be nice.

0 Kudos