AnsweredAssumed Answered

How can I find out if the layer IDs are fixed in mxd through ArcObjects?

Question asked by scarenci on Mar 2, 2017
Latest reply on Nov 7, 2018 by michael.widmer

I would like to know how can I find out if the layer IDs are fixed in mxd through ArcObjects? I usually use the code below to find the layer ids in mxd:

 

IMapDocument mapDocument = new MapDocumentClass();
mapDocument.Open("C:\\Temp\\MyProject.mxd");
IMap b = mapDocument.get_Map(0);
ILayerExtensions c = b.get_Layer(0) as ILayerExtensions;
IServerLayerExtension g = c.get_Extension(0) as IServerLayerExtension;

IPropertySet psN = new PropertySet();
psN.GetProperty("ServiceLayerID");

But when the ids are not fixed the returned Layer ID is wrong, because it follows the order of the layers included in the mxd.

 

By fixed ids i mean the configuration of Data Frame Properties General tab, when you check the box "Allow assignement of unique numeric IDs for map service publishing"

Outcomes