How do you programatically access the Export and Print buttons on the Sharing tab?

606
2
07-02-2018 06:55 AM
ScottDickison1
New Contributor

Is there any way to execute the Print or Export buttons on the Sharing ribbon? I'm trying to write a simple tool that automates the creation of a layout and I'd like to be able to trigger the stock tools from a button on my dockpane.

Thanks,

Scott Dickison

LOJIC

0 Kudos
2 Replies
UmaHarano
Esri Regular Contributor

Here is a sample that shows you how you can use ArcGIS Pro commands in your own add-ins: HookProCommands

In your case, here are the snippets to execute Pro's Export button. The id to use for the print button is: "esri_sharing_PrintMap"

IPlugInWrapper wrapper = FrameworkApplication.GetPlugInWrapper("esri_sharing_ExportMap");
var command = wrapper as ICommand; // tool and command(Button) supports this
if ((command != null) && command.CanExecute(null))
   command.Execute(null);

Thanks

Uma

0 Kudos
ScottDickison1
New Contributor

Great! Thank you very much!

0 Kudos