Recently, I used the SDK to make a small plug-in. I need to get the URL of the layer when adding the layer. In fact, only when the type of the layer is ServiceLayer can I get the URL. But if I want to add a local data, similar to "C:\temp\test.shp", but in the Layer property can not get the URL (or Path, DataSource and other properties), so, is the SDK designed like this or still can use other method to get the URL.
Attach some code (Sure, is URL property, not URI property )
private void AddLayer(LayerEventsArgs args)
List<Layer> layerList = args.Layers as List<Layer>;
if (layerList != null && layerList.Count != 0)
Layer layer = layerList as Layer;
string url = GetLayerUrl(layer);
private string GetLayerUrl(Layer layer)
// Determine whether the layer has URL property, if has, get URL value.
return layer?.GetType()?.GetProperty("URL")?.GetValue(layer) as string;