Thanks Richard. That helps for sure. I updated my post while you were responding with an additional question
Reason being is, I am setting up a spreadsheet that include a column for dataSources and one for its associated layer file. Each layer files are set up quite dynamically (some make use of group layers, otehrs are standalone feature layers) and there are a couple hundred of them. Instead of scripting to iterate over each individual layer file to test, I would rather just find the path, stick it into my spreadsheet and read the path from there. I don't think there is a file path structure to a feature layer within a group layer, but I thought I'd ask.
You don't query the GroupLayer for the Feature layer paths inside of it. You only query feature layers for the path and determine the feature layer groups by doing the opposite and querying the longName of each feature layer to find out if it is in a group layer. The helps says:"There are two ways of determining if a layer is a group layer. First, you can check to see if the layer supports the isGroupLayer property. Second, you can evaluate the longName property. A layer's longName value will include the group name in addition to the layer name. For example, a layer named Layer1 in a group layer named Group1 will have a longName value of Group1\Layer1. If the name value is equal to longName value, then the layer is not a group layer or the layer is not inside a group layer."So something like this should work:for lyr in arcpy.mapping.ListLayers(mxd,"",df):
Layer = arcpy.mapping.Layer(path_to_LayerFile)
if Layer.isFeatureLayer:
if Layer.longName <> Layer.name:
groupLayerNames = layer.longName.split(r"\")
for i = 0 to len(grougLayerNames) - 1:
print groupLayerNames
arcpy.ApplySymbologyFromLayer_management (lyr, Layer)
I am not sure if multiple group layer levels are handled in the longName property or if only the immediate parent Group layer is listed. If all group layers containing a feature layer are included in the longName, then the for loop can get all of the group containers in order. If only the immediate parent group layer is listed at each level then some form or recursion method would have to work its way out to the outermost group and keep track of each inner group layer level.