Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to get the "Catalog Path" of a Feature Layer's data source in the table of contents of ArcMap using ArcObjects. This is very straightforward in arcpy but seemingly not so much in ArcObjects.

In arcpy, the Layer.dataSource property returns the "Catalog Path" of the layer. For example, for an SDE feature class in a feature dataset, it returns something like:

Database Connections\MyConnection.sde\SDE.MyFeatureDataset\SDE.MyFeatureClass

The help says that the dataSource property is just the workspacePath and datasetName properties combined, but this is not exactly true. For one, the workspacePath property expands the "Database Connections" shortcut, and secondly it does not include the feature dataset name. Thus workspacePath returns something like:

c:\Documents and Settings\user\Application Data\ESRI\Desktop10.0\ArcCatalog\MyConnection.sde

Incidentally this is also the value returned by IWorkspaceName.PathName.

So is there an ArcObjects property that corresponds directly to the Layer.dataSource property, or is additional logic needed to build the same "Catalog Path" from the available ArcObjects interfaces?

share|improve this question
Did you try using IGpUtilities2.MakeGP value, then use GetUnQualifiedCatalogPath? I find this God Object hard to comprehend sometimes. – Kirk Kuykendall Oct 21 '11 at 21:37
I sure hadn't! Using MakeGPValueFromObject on the IFeatureLayer object and passing that to GetUnQualifiedCatalogPath just returned the the short name of the feature class, i.e. SDE.MyFeatureClass. – blah238 Oct 21 '11 at 21:48
up vote 2 down vote accepted

@Kirk's comment got me close enough to figure it out. Thanks!

  1. Send the layer to IGPUtilities.MakeGPLayerFromLayer.
  2. Get the DataElement from the GPLayer
  3. Return the DataElement.CatalogPath value
share|improve this answer

Your Answer


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.