AnsweredAssumed Answered

Listing Saved MXD and SDE Connection Layers using ArcObjects and C#

Question asked by behClevest on Aug 29, 2017
Latest reply on Oct 22, 2017 by Holywhippet

Can you please let me know how I can list all layers inside a saved .mxd map and also get list of layers inside a SDE database connection using c# and ArcObjects? For example if I have a map document like "C:/GIS/Project.mxd" and a sde connection to enterprise geodatabase like "projects.sde" under database connection node, h lo w can I get access to them and list their contents?

I know how to do this using Python - ArcPy scripting like

import arcpy 
mxd = arcpy.mapping.MapDocument(r"C:\GIS\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "")[0]
for lyr in arcpy.mapping.ListLayers(mxd, "", df):

But couldn't find a solution for ArcObject!