Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
share|improve this question
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 Jul 20 '11 at 7:54

2 Answers 2

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

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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