BrokenLegMike

Accessing Map Document Properties via arcpy.mapping

Discussion created by BrokenLegMike on May 9, 2011
Latest reply on May 13, 2011 by BrokenLegMike
Hey folks,

I am trying to access the Map Document properties through the arcpy.mapping.MapDocuments module.

My issue is, I lose the original information in the fields in the Map Document properties window (File --> Map Document properties...) I am trying to read and write the "Author" of the map. I have set a script to loop through a series of mxd's, make some changes and then SaveACopy to a 9.3 version. Everytime it saves the copy, I lose all the Map Document Properties (ie Author, Title, Summary, etc) In the saved document, those fields turn blank.

I have attempted to try to write to those fields to populate the information I want, but I'm at a wall. When the script opens the mxd's through the loop, I set it to print the mxd.author. That works fine. It prints the authors name, but when I open the mxd after the script has finished, this field is blank. I'm not sure if it gets lost when I use the "SaveACopy" method. Any suggestions?

# Import arcpy module
import arcpy
import os
import glob

folderPath = r"\\Chip\FolderRedirections\John.Doe\Desktop\Test"
    for filename in glob.glob(os.path.join(folderPath, "*.mxd")):
        print "Editing", filename
        mxd = arcpy.mapping.MapDocument(filename)
        # This print statement works. I get the return value of mxd.author
        print mxd.author
    
        mxd.saveACopy(filename + "_93.mxd", '9.3') 
        del mxd

       #After I SaveACopy, I lose the "author" properties information in the new mxd

Outcomes