How would I go about identifying all the mxd files that have graphics?
I reckon it's close to:
import arcpy
import os
srcPath = "my_path"
mxd_lst = [f for f in os.listdir(srcPath) if f.endswith('.mxd')]
for mxd in mxd_lst:
for dfrm in arcpy.mapping.ListDataFrames(mxd):
if "GRAPHIC_ELEMENT" in dfrm != None: # *I'm making this line up*
print(mxd + " has graphic elements")
else:
print(mxd + " does not contain graphics")
arcpy.mapping.ListDataFrames()method. This will only find data frame objects. Once the DF is identified, then you could do a nested for loop with, for example, arcpy.mapping.ListLayers(). – Keggering Jul 02 '21 at 06:00listLayoutElementsdoes not. Per ESRI: "ListLayoutElements only returns elements from a page layout and not map annotation elements that may exist within a data frame." https://desktop.arcgis.com/en/arcmap/10.7/analyze/arcpy-mapping/listlayoutelements.htm – Keggering Jul 02 '21 at 15:42