Hi Robert LeClair
So I've been trying to use the Geoprocessing.ExecuteToolAsync("ApplySymbologyFromLayer_management"....) method for applying a .lyr/.lyrx file to a layer. According to all the documentation this should work, but I cannot get it to work as a C# add-in, or using a simple Python script. Can you confirm if there are any issues with this tool and how it works?? I've spent a lot of time on this already and don't want to continue if there are known issues.
See Building proper syntax for importing .lyr symbology for Feature Layer .
async private void btnSymbolize_Click(object sender, RoutedEventArgs e)
{
try
{
Map map = MapView.Active.Map;
pBar.Minimum = 0;
pBar.Maximum = map.Layers.Count;
this.Cursor = Cursors.Wait;
GPExecuteToolFlags flags = GPExecuteToolFlags.GPThread;
foreach (Layer layer in map.GetLayersAsFlattenedList().OfType<FeatureLayer>())
{
var gpresult = await Geoprocessing.ExecuteToolAsync("ApplySymbologyFromLayer_management", new string[] { layer.Name.ToString(), @"K:\DSM Shared\ArcMap Symbology\10.2 Schema\Editing Symbols\" + layer.Name.ToString() + ".lyr" }, null, null, flags);
pBar.Value = pBar.Value + 1;
}
}
catch (Exception ex)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show(ex.ToString());
}
finally
{
this.Cursor = Cursors.Arrow;
this.Close();
}
}