3

When you save an ArcGIS map document (MXD) and then change the data source of a layer in the MXD, you can no longer see the layer in the MXD and you must redefine its data source.

But suppose you need to discover the previous data source's feature class name. In ArcMap, you can find it under the layer's Properties -> Source Tab, but I want to access this information programmatically.

I tried the code below but it doesn't work for this kind of layer. Can anyone suggest another method for retrieving the properties of a layer whose data source has been lost?

ctype(mLayer,IFeatureLayer).aliasname
1
  • 1
    This will fail as the source doesn't exist. Try using a property dialog...and retrieve the value from there. Refer this link and this forum link
    – ujjwalesri
    Commented Jul 20, 2011 at 7:54

2 Answers 2

7

If the layer implements the IDataLayer interface (most layers do), you can access its IDataLayer.DataSourceName property.

For example, for a feature layer, this property will return the FeatureClassName object, which provides various interfaces to examine the data source.

1

This will fail as the source doesn't exist.
Try using a property dialog...and retrieve the value from there. Refer this link and this forum link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.