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
blah238
35.9k8 gold badges97 silver badges204 bronze badges
asked Jul 19, 2011 at 9:01
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 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.

answered Jul 20, 2011 at 11:11
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

answered Jul 20, 2011 at 7:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.