<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Acces Metadata for map service Arcpy in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/acces-metadata-for-map-service-arcpy/m-p/660208#M51303</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI communauty geonet, and users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to update the metadatas (summary, details, Authors, ...) of many mxds in a folder and when i execute my python script all is ok (no error).&lt;/P&gt;&lt;P&gt;When i have for exemple 3 mxds in a folder, and when i open the propriety of the first mxd in the list the information is ok.&lt;/P&gt;&lt;P&gt;But when i&amp;nbsp; open the second mxd the information in the case is null. And when Open Mapdocument the information is ok for this second mxd.&lt;/P&gt;&lt;P&gt;My problem is for my second script when a push the mxds in arcgis server. On the service map the information is ok for the first and not for the other. My code is this one (sorry for my english):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# -*- coding: cp1252 -*-&lt;/P&gt;&lt;P&gt;#import modules&lt;/P&gt;&lt;P&gt;import arcpy, sys, os, string&lt;/P&gt;&lt;P&gt;import xml.dom.minidom as DOM&lt;/P&gt;&lt;P&gt;import codecs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Read parameters from dialog&lt;/P&gt;&lt;P&gt;filedoss = arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;u = arcpy.GetParameterAsText(1)&lt;/P&gt;&lt;P&gt;Summary = u.encode('cp1252', 'strict')&lt;/P&gt;&lt;P&gt;i = arcpy.GetParameterAsText(2)&lt;/P&gt;&lt;P&gt;Description = i.encode('cp1252', 'strict')&lt;/P&gt;&lt;P&gt;o = arcpy.GetParameterAsText(3)&lt;/P&gt;&lt;P&gt;Author = o.encode('cp1252', 'strict')&lt;/P&gt;&lt;P&gt;Credits = o.encode('cp1252', 'strict')&lt;/P&gt;&lt;P&gt;fileanc =&amp;nbsp; arcpy.GetParameterAsText(4)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MapPath= []&lt;/P&gt;&lt;P&gt;MapFolder = os.listdir(filedoss)&lt;/P&gt;&lt;P&gt;arcpy.env.workspace = filedoss&lt;/P&gt;&lt;P&gt;for file in MapFolder:&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileExt = os.path.splitext(file)[1]&lt;/P&gt;&lt;P&gt;&amp;nbsp; if fileExt == ".mxd":&lt;/P&gt;&lt;P&gt;&amp;nbsp; MapPath = os.path.join(filedoss, file)&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddMessage (MapPath)&lt;/P&gt;&lt;P&gt;&amp;nbsp; #set map document to change&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd = arcpy.mapping.MapDocument(MapPath)&lt;/P&gt;&lt;P&gt;&amp;nbsp; base = os.path.basename(filedoss).upper()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #Nouveau nom&lt;/P&gt;&lt;P&gt;&amp;nbsp; file_name_temp = "NOM_" + base + "_" + file&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #arcpy.AddMessage ("MXD a sauvegarder :" + file_name)&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddMessage ("MXD sauvegarde :"&amp;nbsp; + file_name_temp)&lt;/P&gt;&lt;P&gt;&amp;nbsp; # Test existence de la sauvegarde&lt;/P&gt;&lt;P&gt;&amp;nbsp; if os.path.exists(file_name_temp):&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddMessage("Fichier mxd existe")&lt;/P&gt;&lt;P&gt;&amp;nbsp; try :&lt;/P&gt;&lt;P&gt;&amp;nbsp; # essaye de le supprimer&lt;/P&gt;&lt;P&gt;&amp;nbsp; os.remove(file_name_temp)&lt;/P&gt;&lt;P&gt;&amp;nbsp; except :&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddError ("Fichier non sauvegarde : impossible de le supprimer")&lt;/P&gt;&lt;P&gt;&amp;nbsp; sys.exit() &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #change Title&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.title = file_name_temp&lt;/P&gt;&lt;P&gt;&amp;nbsp; #change Summary&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.summary = Summary&lt;/P&gt;&lt;P&gt;&amp;nbsp; #change Description&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.description = Description&lt;/P&gt;&lt;P&gt;&amp;nbsp; #change Author&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.author = Author&lt;/P&gt;&lt;P&gt;&amp;nbsp; #change credits&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.credits = Credits&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #Update map document tags&lt;/P&gt;&lt;P&gt;&amp;nbsp; #Generate unique, sorted list of layer names&lt;/P&gt;&lt;P&gt;&amp;nbsp; layers = arcpy.mapping.ListLayers(mxd)&lt;/P&gt;&lt;P&gt;&amp;nbsp; layerList = []&lt;/P&gt;&lt;P&gt;&amp;nbsp; for lyr in layers:&lt;/P&gt;&lt;P&gt;&amp;nbsp; if not lyr.isGroupLayer:&lt;/P&gt;&lt;P&gt;&amp;nbsp; layerList.append(lyr.name)&lt;/P&gt;&lt;P&gt;&amp;nbsp; uniqueList = list(set(layerList))&lt;/P&gt;&lt;P&gt;&amp;nbsp; uniqueList.sort()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #Update map document tags&lt;/P&gt;&lt;P&gt;&amp;nbsp; tagList = ",".join(uniqueList)&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.tags = tagList&lt;/P&gt;&lt;P&gt;&amp;nbsp; for lyr in layers:&lt;/P&gt;&lt;P&gt;&amp;nbsp; if lyr.supports("DATASOURCE"): &lt;/P&gt;&lt;P&gt;&amp;nbsp; lyr.replaceDataSource(filedoss, 'SHAPEFILE_WORKSPACE', lyr.datasetName, False)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #set relative paths property&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.relativePaths = True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #update Thumbnail&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.deleteThumbnail()&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.makeThumbnail()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #save map document change&lt;/P&gt;&lt;P&gt;&amp;nbsp; #SAuvegarde sous nouveau &lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.saveACopy(file_name_temp)&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddMessage ("Fichier sauvegarde")&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.RefreshTOC()&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.RefreshActiveView()&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.RefreshCatalog(file_name_temp)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;del mxd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 18 Apr 2015 10:37:23 GMT</pubDate>
    <dc:creator>EQUIPEIS</dc:creator>
    <dc:date>2015-04-18T10:37:23Z</dc:date>
    <item>
      <title>Acces Metadata for map service Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/acces-metadata-for-map-service-arcpy/m-p/660208#M51303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI communauty geonet, and users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I try to update the metadatas (summary, details, Authors, ...) of many mxds in a folder and when i execute my python script all is ok (no error).&lt;/P&gt;&lt;P&gt;When i have for exemple 3 mxds in a folder, and when i open the propriety of the first mxd in the list the information is ok.&lt;/P&gt;&lt;P&gt;But when i&amp;nbsp; open the second mxd the information in the case is null. And when Open Mapdocument the information is ok for this second mxd.&lt;/P&gt;&lt;P&gt;My problem is for my second script when a push the mxds in arcgis server. On the service map the information is ok for the first and not for the other. My code is this one (sorry for my english):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# -*- coding: cp1252 -*-&lt;/P&gt;&lt;P&gt;#import modules&lt;/P&gt;&lt;P&gt;import arcpy, sys, os, string&lt;/P&gt;&lt;P&gt;import xml.dom.minidom as DOM&lt;/P&gt;&lt;P&gt;import codecs&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#Read parameters from dialog&lt;/P&gt;&lt;P&gt;filedoss = arcpy.GetParameterAsText(0)&lt;/P&gt;&lt;P&gt;u = arcpy.GetParameterAsText(1)&lt;/P&gt;&lt;P&gt;Summary = u.encode('cp1252', 'strict')&lt;/P&gt;&lt;P&gt;i = arcpy.GetParameterAsText(2)&lt;/P&gt;&lt;P&gt;Description = i.encode('cp1252', 'strict')&lt;/P&gt;&lt;P&gt;o = arcpy.GetParameterAsText(3)&lt;/P&gt;&lt;P&gt;Author = o.encode('cp1252', 'strict')&lt;/P&gt;&lt;P&gt;Credits = o.encode('cp1252', 'strict')&lt;/P&gt;&lt;P&gt;fileanc =&amp;nbsp; arcpy.GetParameterAsText(4)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MapPath= []&lt;/P&gt;&lt;P&gt;MapFolder = os.listdir(filedoss)&lt;/P&gt;&lt;P&gt;arcpy.env.workspace = filedoss&lt;/P&gt;&lt;P&gt;for file in MapFolder:&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileExt = os.path.splitext(file)[1]&lt;/P&gt;&lt;P&gt;&amp;nbsp; if fileExt == ".mxd":&lt;/P&gt;&lt;P&gt;&amp;nbsp; MapPath = os.path.join(filedoss, file)&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddMessage (MapPath)&lt;/P&gt;&lt;P&gt;&amp;nbsp; #set map document to change&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd = arcpy.mapping.MapDocument(MapPath)&lt;/P&gt;&lt;P&gt;&amp;nbsp; base = os.path.basename(filedoss).upper()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #Nouveau nom&lt;/P&gt;&lt;P&gt;&amp;nbsp; file_name_temp = "NOM_" + base + "_" + file&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #arcpy.AddMessage ("MXD a sauvegarder :" + file_name)&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddMessage ("MXD sauvegarde :"&amp;nbsp; + file_name_temp)&lt;/P&gt;&lt;P&gt;&amp;nbsp; # Test existence de la sauvegarde&lt;/P&gt;&lt;P&gt;&amp;nbsp; if os.path.exists(file_name_temp):&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddMessage("Fichier mxd existe")&lt;/P&gt;&lt;P&gt;&amp;nbsp; try :&lt;/P&gt;&lt;P&gt;&amp;nbsp; # essaye de le supprimer&lt;/P&gt;&lt;P&gt;&amp;nbsp; os.remove(file_name_temp)&lt;/P&gt;&lt;P&gt;&amp;nbsp; except :&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddError ("Fichier non sauvegarde : impossible de le supprimer")&lt;/P&gt;&lt;P&gt;&amp;nbsp; sys.exit() &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #change Title&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.title = file_name_temp&lt;/P&gt;&lt;P&gt;&amp;nbsp; #change Summary&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.summary = Summary&lt;/P&gt;&lt;P&gt;&amp;nbsp; #change Description&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.description = Description&lt;/P&gt;&lt;P&gt;&amp;nbsp; #change Author&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.author = Author&lt;/P&gt;&lt;P&gt;&amp;nbsp; #change credits&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.credits = Credits&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #Update map document tags&lt;/P&gt;&lt;P&gt;&amp;nbsp; #Generate unique, sorted list of layer names&lt;/P&gt;&lt;P&gt;&amp;nbsp; layers = arcpy.mapping.ListLayers(mxd)&lt;/P&gt;&lt;P&gt;&amp;nbsp; layerList = []&lt;/P&gt;&lt;P&gt;&amp;nbsp; for lyr in layers:&lt;/P&gt;&lt;P&gt;&amp;nbsp; if not lyr.isGroupLayer:&lt;/P&gt;&lt;P&gt;&amp;nbsp; layerList.append(lyr.name)&lt;/P&gt;&lt;P&gt;&amp;nbsp; uniqueList = list(set(layerList))&lt;/P&gt;&lt;P&gt;&amp;nbsp; uniqueList.sort()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #Update map document tags&lt;/P&gt;&lt;P&gt;&amp;nbsp; tagList = ",".join(uniqueList)&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.tags = tagList&lt;/P&gt;&lt;P&gt;&amp;nbsp; for lyr in layers:&lt;/P&gt;&lt;P&gt;&amp;nbsp; if lyr.supports("DATASOURCE"): &lt;/P&gt;&lt;P&gt;&amp;nbsp; lyr.replaceDataSource(filedoss, 'SHAPEFILE_WORKSPACE', lyr.datasetName, False)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #set relative paths property&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.relativePaths = True&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #update Thumbnail&lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.deleteThumbnail()&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.makeThumbnail()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; #save map document change&lt;/P&gt;&lt;P&gt;&amp;nbsp; #SAuvegarde sous nouveau &lt;/P&gt;&lt;P&gt;&amp;nbsp; mxd.saveACopy(file_name_temp)&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.AddMessage ("Fichier sauvegarde")&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.RefreshTOC()&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.RefreshActiveView()&lt;/P&gt;&lt;P&gt;&amp;nbsp; arcpy.RefreshCatalog(file_name_temp)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;del mxd&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 18 Apr 2015 10:37:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/acces-metadata-for-map-service-arcpy/m-p/660208#M51303</guid>
      <dc:creator>EQUIPEIS</dc:creator>
      <dc:date>2015-04-18T10:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: Acces Metadata for map service Arcpy</title>
      <link>https://community.esri.com/t5/python-questions/acces-metadata-for-map-service-arcpy/m-p/660209#M51304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;i publish an auto-reponse for one problem. But it's not resolved totaly.&lt;/P&gt;&lt;P&gt;The old MXD came from an Arcgis 9.3 and the properties is not update if i d'ont open Mapdocument &lt;/P&gt;&lt;P&gt;in the version 10.2.2. The link to the default database is null. When i open in Arcmap the link is ok tio the default geodatabase.&lt;/P&gt;&lt;P&gt;But i have a lot of MXS and it's impossible to open all. My question is :It's possible in ArcPy to automatilly&lt;/P&gt;&lt;P&gt;like the others properties (Summary, Authors ,...) to put this information of default geodatabase for many old MXD ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank a lot&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 Apr 2015 10:34:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/acces-metadata-for-map-service-arcpy/m-p/660209#M51304</guid>
      <dc:creator>EQUIPEIS</dc:creator>
      <dc:date>2015-04-19T10:34:08Z</dc:date>
    </item>
  </channel>
</rss>

