Accessing Map Document Properties via arcpy.mapping

2680
1
05-09-2011 10:48 AM
MikeMacRae
Occasional Contributor III
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

Tags (2)
0 Kudos
1 Reply
MikeMacRae
Occasional Contributor III
Apparently this is a bug in the "Save A Copy" function. I contacted ESRI and now they are waiting to hear from Redlands.

I would suggest using "Save a Copy" tosave your .mxd's first off, and then reopen those copies and process on them.

Thanks,
Mike
0 Kudos