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?

  • 3
    Did you try using IGpUtilities2.MakeGP value, then use GetUnQualifiedCatalogPath? I find this God Object hard to comprehend sometimes. Commented Oct 21, 2011 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
    Commented Oct 21, 2011 at 21:48

1 Answer 1


@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

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.