<?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 Re: Need to Replace Out of Date Map Services in MXDs in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616019#M48059</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Matt:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are probably right about not being able to replace the datasource.&amp;nbsp; I would try to use the UpdateLayer method, but this might not be possible because the source might already be broken. You would need to know what the starting layer is so you know what layer to replace it with if you have multiple mapservices to choose from.&amp;nbsp; This would be important if you had many mapservices that were retired at once and replaced with newer mapservices.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The UpdateLayer method is how I converted raster images sourced from SDE with raster mosaic datasets sourced from a mapped network location.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 11 Oct 2013 18:16:19 GMT</pubDate>
    <dc:creator>MichaelVolz</dc:creator>
    <dc:date>2013-10-11T18:16:19Z</dc:date>
    <item>
      <title>Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616014#M48054</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;We just upgraded ArcGIS Server from 10.0 to 10.1.&amp;nbsp; Several users have MXDs that contain a map service that retired during the upgrade.&amp;nbsp; With the map service gone those MXDs take 10 to 30 minutes to open and another 5 minutes just to right click on the service in the TOC so it can be removed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What is there in ArcPy to find and replace map services?&amp;nbsp; Let me know if this topic should go in another forum.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And, why the heck does ArcGIS Desktop spend so much time looking for a map service before giving up?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 21:58:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616014#M48054</guid>
      <dc:creator>RandyKreuziger</dc:creator>
      <dc:date>2013-10-09T21:58:04Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616015#M48055</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Looks like &lt;/SPAN&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/#/Layer/00s300000008000000/"&gt;layer objects&lt;/A&gt;&lt;SPAN&gt; contain information for services in 'serviceProperties' but it's a read-only attribute. You'll probably have to setup the script to use AddLayer(), RemoveLayer(), etc. instead of findAndReplaceWorkspacePath()/replaceDataSource().&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Edit: Actually looking a little deeper at AddLayer(), I'm not 100% sure if that will work, as it takes a path to a layer file. Is it possible to save a layer file for a service?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Oct 2013 22:31:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616015#M48055</guid>
      <dc:creator>MattSayler</dc:creator>
      <dc:date>2013-10-09T22:31:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616016#M48056</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks Matt, RemoveLayer will work.&amp;nbsp; I've just got one last problem.&amp;nbsp; Since I'm running this script for other users I don't want to remove all layers with broken datasources.&amp;nbsp; A user may have data on their C: drive or a protected network folder, but since I'm running the script those layers show up as broken.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;.The only thing I want to remove are broken map services.&amp;nbsp; Unfortunately, I haven't been able to find just map services.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The line with lyr.supports("SERVICEPROPERTIES") errors off if the broken layer is a table view since TableViews don't have the SUPPORTS attribute.&amp;nbsp; Any ideas.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;i&lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mport arcpy

fileName = "DBS100"
myMXD = "H:/_maps/" + fileName + ".mxd"
print myMXD
mxd = arcpy.mapping.MapDocument(myMXD)
for df in arcpy.mapping.ListDataFrames(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for lyr in arcpy.mapping.ListBrokenDataSources(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "&amp;nbsp; Broken DataSource: " + lyr.name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # TableViews are erroring off because that object has no supports attribute .
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("SERVICEPROPERTIES"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.serviceProperties['ServiceType'] == "MapServer":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print lyr.serviceProperties

del mxd&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:19:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616016#M48056</guid>
      <dc:creator>RandyKreuziger</dc:creator>
      <dc:date>2021-12-12T02:19:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616017#M48057</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is definitely going to be a problem.&amp;nbsp; Is there anyway you can restore the old mapservices again, so you can run a python script to remove and/or replace these mapservices?&amp;nbsp; Can you have both versions of ArcGIS Server running at the same time or did you upgrade in place?&amp;nbsp; This would be a reason why you would want to build new servers when you upgrade your ArcGIS Server environment.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 17:12:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616017#M48057</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-10-11T17:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616018#M48058</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Thanks Matt, RemoveLayer will work.&amp;nbsp; I've just got one last problem.&amp;nbsp; Since I'm running this script for other users I don't want to remove all layers with broken datasources.&amp;nbsp; A user may have data on their C: drive or a protected network folder, but since I'm running the script those layers show up as broken.&lt;BR /&gt;&lt;BR /&gt;.The only thing I want to remove are broken map services.&amp;nbsp; Unfortunately, I haven't been able to find just map services.&lt;BR /&gt;The line with lyr.supports("SERVICEPROPERTIES") errors off if the broken layer is a table view since TableViews don't have the SUPPORTS attribute.&amp;nbsp; Any ideas.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;i&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mport arcpy

fileName = "DBS100"
myMXD = "H:/_maps/" + fileName + ".mxd"
print myMXD
mxd = arcpy.mapping.MapDocument(myMXD)
for df in arcpy.mapping.ListDataFrames(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; for lyr in arcpy.mapping.ListBrokenDataSources(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "&amp;nbsp; Broken DataSource: " + lyr.name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # TableViews are erroring off because that object has no supports attribute .
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("SERVICEPROPERTIES"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.serviceProperties['ServiceType'] == "MapServer":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print lyr.serviceProperties

del mxd&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;You could use ListLayers() instead of ListBrokenDataSources(), and just look for layers that have service properties that match the old service. It might work out better to make all your checks fairly explicit since there are a variety of situations you have to work with.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;This is definitely going to be a problem.&amp;nbsp; Is there anyway you can restore the old mapservices again, so you can run a python script to remove and/or replace these mapservices?&amp;nbsp; Can you have both versions of ArcGIS Server running at the same time or did you upgrade in place?&amp;nbsp; This would be a reason why you would want to build new servers when you upgrade your ArcGIS Server environment.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think you can replace the source for services like you can for layers because it's not just a file path. You have to update the server, service name, etc. which are read-only. Using arcpy to remove and add the services as layers is the only way to automate this right now as far as I can tell. I'm not 100% sure, but that's what it has looked like from the research I've done.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:19:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616018#M48058</guid>
      <dc:creator>MattSayler</dc:creator>
      <dc:date>2021-12-12T02:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616019#M48059</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Matt:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You are probably right about not being able to replace the datasource.&amp;nbsp; I would try to use the UpdateLayer method, but this might not be possible because the source might already be broken. You would need to know what the starting layer is so you know what layer to replace it with if you have multiple mapservices to choose from.&amp;nbsp; This would be important if you had many mapservices that were retired at once and replaced with newer mapservices.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The UpdateLayer method is how I converted raster images sourced from SDE with raster mosaic datasets sourced from a mapped network location.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 18:16:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616019#M48059</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-10-11T18:16:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616020#M48060</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Oh, that's a good idea. UpdateLayer uses an existing lyr file, same as AddLayer, correct? I told Randy to use AddLayer and RemoveLayer, but I bet that would shortcut things a little. I was thinking that wouldn't work because of the Read-Only attributes, but it probably just does a remove and an add under the hood.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can a lyr file be saved for a service though? That's the biggest question in my mind.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 18:57:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616020#M48060</guid>
      <dc:creator>MattSayler</dc:creator>
      <dc:date>2013-10-11T18:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616021#M48061</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I would think you could create a lyr file from a service as my organization has a few lyr files like this.&amp;nbsp; I believe the only problem with this method is if the mapservice exists in a group layer as you need to know the index of the layer inside the group layer if you want it to maintain its visibility with respect to the other layers in the group layer.&amp;nbsp; This might not be the case, so it would need to be tested.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Oct 2013 19:08:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616021#M48061</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-10-11T19:08:35Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616022#M48062</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It finally came to me.&amp;nbsp; Putting the &lt;/SPAN&gt;&lt;STRONG&gt;supports("SERVICEPROPERTIES")&lt;/STRONG&gt;&lt;SPAN&gt; inside a try except was the missing piece.&amp;nbsp; Now I should be able to remove all broken map services without it failing when the broken layer is a TableView.&amp;nbsp; See the code below.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;New question.&amp;nbsp; Is there a way in 10.1 to determine the MXD version?&amp;nbsp; I'd like to run this script on 10.1 but save out MXD in the same version as the original. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;mxd = arcpy.mapping.MapDocument(myMXD)
for df in arcpy.mapping.ListDataFrames(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "*** New Data Frame"
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "&amp;nbsp;&amp;nbsp;&amp;nbsp; Listing Data Frame Layers"
&amp;nbsp;&amp;nbsp;&amp;nbsp; for lyr in arcpy.mapping.ListBrokenDataSources(mxd):&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "&amp;nbsp; Broken DataSource: " + lyr.name
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; # TableViews are erroring off because that object has no attribute supports.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("SERVICEPROPERTIES"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.serviceProperties['ServiceType'] == "MapServer":
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "MapServer"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print lyr.serviceProperties
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Layer has no SUPPORTS attribute: " + lyr.name&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:19:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616022#M48062</guid>
      <dc:creator>RandyKreuziger</dc:creator>
      <dc:date>2021-12-12T02:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616023#M48063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not seeing it in the map document properties directly. Kind of strange since you can select a version using the 'saveACopy' method. 'Describe()' will only return the type ("MapDocument"). &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Only other way I can think of is to test for properties that are unique to different versions. Looks like there are some candidates between 10.0 and 10.1 at least:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/#/MapDocument/00s30000000n000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://resources.arcgis.com/en/help/main/10.1/#/MapDocument/00s30000000n000000/&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/MapDocument/00s30000000n000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/MapDocument/00s30000000n000000/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;for example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;if mxd.activeDataFrame:
&amp;nbsp;&amp;nbsp;&amp;nbsp; print "Version 10.1"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Not sure how bulletproof that methodology will be though.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:19:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616023#M48063</guid>
      <dc:creator>MattSayler</dc:creator>
      <dc:date>2021-12-12T02:19:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616024#M48064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Document versioning needs to be added.&amp;nbsp; Please add this to the ideas site.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The above idea is good but it only tells you what version of ArcGIS is installed, not what version the MXD is.&amp;nbsp; The text element class is the most useful for this:&amp;nbsp; text.textAngle = 10.2, text.clone=10.1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jeff&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Oct 2013 13:29:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616024#M48064</guid>
      <dc:creator>JeffBarrette</dc:creator>
      <dc:date>2013-10-14T13:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616025#M48065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Document versioning needs to be added.&amp;nbsp; Please add this to the ideas site.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;There are at least 3 relevant proposals in the ideas site. Time to vote &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://c.na9.visual.force.com/apex/ideaView?id=087E00000004qGSIAY"&gt;https://c.na9.visual.force.com/apex/ideaView?id=087E00000004qGSIAY&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://c.na9.visual.force.com/apex/ideaView?id=087E00000004b98IAA"&gt;https://c.na9.visual.force.com/apex/ideaView?id=087E00000004b98IAA&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://c.na9.visual.force.com/apex/ideaView?id=08730000000c1LUAAY"&gt;https://c.na9.visual.force.com/apex/ideaView?id=08730000000c1LUAAY&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Oct 2013 14:50:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616025#M48065</guid>
      <dc:creator>RandyKreuziger</dc:creator>
      <dc:date>2013-10-14T14:50:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616026#M48066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;In regards to ArcMap maintenance it would be good if the user had the option of either embedding the SDE credentials in the mxd or using .sde files outside the mxd to create the necessary SDE connections.&amp;nbsp; This could mean the difference between updating a few .sde files as opposed to thousands or more SDE connections inside mxd files.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please vote at the following location:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://ideas.arcgis.com/ideaView?id=087E00000004wTD&amp;amp;returnUrl=%2Fapex%2FideaList%3Fc%3D09a300000004xET%26category%3D%26p%3D2%26sort%3Drecent"&gt;http://ideas.arcgis.com/ideaView?id=087E00000004wTD&amp;amp;returnUrl=%2Fapex%2FideaList%3Fc%3D09a300000004xET%26category%3D%26p%3D2%26sort%3Drecent&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Oct 2013 14:56:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616026#M48066</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-10-14T14:56:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616027#M48067</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just when I thought I had it :mad:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With several users dead in the water we decided to recreate the missing Map Service so users could get into their MXDs while I work on the script.&amp;nbsp; That's created a new issue.&amp;nbsp; In my script I'm removing all broken Map Services, but now that a dummy Map Service is available there's no broken map services to delete.&amp;nbsp; So I need to delete a Map Service based on its name but I can't figure out how to find the orginal Map Service name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Both lyr.name and lyr.longName display the name from ArcMap's table of contents.&amp;nbsp; Several users have renamed the Map Service name after adding it to the map's TOC, so I'm unable to test for the original name.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;None of the service properties for a Map Service give the source map service name. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="font-family:Courier New;"&gt;print lyr.serviceProperties&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;{u'UserName': u'', &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;u'ServiceType': &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;u'MapServer', &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;u'Connectionfile': u'C:\\Users\\xxxx\\AppData\\Roaming\\ESRI\\Desktop10.0\\ArcCatalog\\arcgis on gisolymap01.ags', &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;u'URL': u'&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://gisolymap01/arcgis/services" rel="nofollow" target="_blank"&gt;http://gisolymap01/arcgis/services&lt;/A&gt;&lt;SPAN&gt;', &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;u'Server': u'', &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;u'Allowinsecuretokenurl': u'0', &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;u'Anonymous': u'-1'}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 15:50:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616027#M48067</guid>
      <dc:creator>RandyKreuziger</dc:creator>
      <dc:date>2013-10-15T15:50:18Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616028#M48068</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;According to documentation for layer in v10.1, the URL should get you the name of the service as this is part of the URL, unless it is through a LAN.&amp;nbsp; Are you working on a LAN when processing this script?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The URL for this documentation is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000008000000"&gt;http://resources.arcgis.com/en/help/main/10.1/index.html#//00s300000008000000&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Go to the area Keys for a web service dictionary.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please let me know if this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My organization has decided to avoid using services in mxds (especially outside services) as you never know when they will be retired which would cause broken links as you are experiencing.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 16:24:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616028#M48068</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-10-15T16:24:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616029#M48069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Michael,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I'm gettting a URL back but it doesn't list the mapservice or the folder.&amp;nbsp; Here is what I get: &lt;/SPAN&gt;&lt;A href="http://aimsw.xxx.wa.lcl/arcgis/services"&gt;http://aimsw.xxx.wa.lcl/arcgis/services&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;According to the documentation the URL will be null if through a LAN&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[INDENT]URL �??Property displaying the URL to the service. If the connection to ArcGIS for Server is through a local area network (LAN), this value will be null[/INDENT]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could it be that ESRI is not making the map service name available through arcpy?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 16:43:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616029#M48069</guid>
      <dc:creator>RandyKreuziger</dc:creator>
      <dc:date>2013-10-15T16:43:02Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616030#M48070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Randy:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would log an incident with ESRI at this point because their documentation is misleading at best.&amp;nbsp; If you are on a LAN, then you should have received a Null value but you got the URL without the service name.&amp;nbsp; If you are not on the LAN, then you should have received the URL including the service name but you did not get the service name in the URL.&amp;nbsp; The documentation that I referred to is for arcpy's mapping module which should be exposed in python.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 16:58:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616030#M48070</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-10-15T16:58:06Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616031#M48071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Just to add to what Michael said at post #15:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the service name is simply fetched with the name property...but 1st you have to make sure it is service - I think at 10.1, more direct access was provided for that property, meaning you don't have to get it from the serviceProperties dictionary; it is simply isServiceLayer (and of course, if true then get the name).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is a little testing on one of my 10.0 map services, and I think you'll get the picture:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; if mapServiceGrp0.supports("SERVICEPROPERTIES"):
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for i, j in mapServiceGrp0.serviceProperties.iteritems():
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "{0}:&amp;nbsp; {1}".format(i, j)
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
UserName:&amp;nbsp; 
ServiceType:&amp;nbsp; MapServer
Connectionfile:&amp;nbsp; C:\Documents and Settings\whitley-wayne\Application Data\ESRI\Desktop10.0\ArcCatalog\mc-gisappserver (admin).ags
URL:&amp;nbsp; 
Managerurl:&amp;nbsp; http://mc-gisapperver/arcgis/services
Server:&amp;nbsp; mc-gisappserver
Allowinsecuretokenurl:&amp;nbsp; 0
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I could have looked up the ServiceType key directly and identified it as a MapServer...but I need the name, so this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; # This 1st one is an SDE 'service' - have to distinguish between SDE and other supporting service layer...
&amp;gt;&amp;gt;&amp;gt; mm = mapLyrs[0]
&amp;gt;&amp;gt;&amp;gt; mm.name
u'MonroeGISData.DBO.BM_MileMarkers'

&amp;gt;&amp;gt;&amp;gt; # so I could have queried a bit further to get type 'SDE' above...but with DBO in the name I already know.
&amp;gt;&amp;gt;&amp;gt; # This 2nd layer is the map service from 1st code section above - I need the name.
&amp;gt;&amp;gt;&amp;gt; mapServiceGrp0 = mapLyrs[1]
&amp;gt;&amp;gt;&amp;gt; mapServiceGrp0.name
u'MonroeCountySDE_Environmental_Layout'
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It should be that simple -- just with 10.1 and above you can readily identify whether a service (and serviceProperties yields more details about that service).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope that helps,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;PS- If it shows better what I mean about 'SDE service' vs for example a 'Map Service', see this where I use an identical technique looping through the serviceProperties dictionary:&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/94600-PLEASE-HELP!-Features-do-not-get-updated-in-Geoprocessing-Service#7" rel="nofollow noopener noreferrer" target="_blank"&gt;http://forums.arcgis.com/threads/94600-PLEASE-HELP!-Features-do-not-get-updated-in-Geoprocessing-Service#7&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:20:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616031#M48071</guid>
      <dc:creator>T__WayneWhitley</dc:creator>
      <dc:date>2021-12-12T02:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616032#M48072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; &lt;BR /&gt;This is a little testing on one of my 10.0 map services, and I think you'll get the picture:&amp;nbsp; &lt;BR /&gt; &lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;gt;&amp;gt;&amp;gt; if mapServiceGrp0.supports("SERVICEPROPERTIES"):
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for i, j in mapServiceGrp0.serviceProperties.iteritems():
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print "{0}:&amp;nbsp; {1}".format(i, j)
...&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
UserName:&amp;nbsp; 
ServiceType:&amp;nbsp; MapServer
Connectionfile:&amp;nbsp; C:\Documents and Settings\whitley-wayne\Application Data\ESRI\Desktop10.0\ArcCatalog\mc-gisappserver (admin).ags
URL:&amp;nbsp; 
Managerurl:&amp;nbsp; http://mc-gisapperver/arcgis/services
Server:&amp;nbsp; mc-gisappserver
Allowinsecuretokenurl:&amp;nbsp; 0
&lt;/PRE&gt; &lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Wayne, using your code from the first example still returns a URL without the map service name. I need the folder /map service name. We do go through a balancer but that shouldn't be a problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;UserName:&amp;nbsp; 
ServiceType:&amp;nbsp; MapServer
Connectionfile:&amp;nbsp; C:\Users\kreuzrsk\AppData\Roaming\ESRI\Desktop10.0\ArcCatalog\arcgis on aimsw.xxx.wa.ags
&lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;&lt;SPAN&gt;URL:&amp;nbsp; &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://aimsw.xxx.wa.lcl/arcgis/services" rel="nofollow noopener noreferrer" target="_blank"&gt;http://aimsw.xxx.wa.lcl/arcgis/services&lt;/A&gt;&lt;/SPAN&gt;
Server:&amp;nbsp; 
Allowinsecuretokenurl:&amp;nbsp; 0
Anonymous:&amp;nbsp; -1 &lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:20:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616032#M48072</guid>
      <dc:creator>RandyKreuziger</dc:creator>
      <dc:date>2021-12-12T02:20:03Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Replace Out of Date Map Services in MXDs</title>
      <link>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616033#M48073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Randy:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the least it seems like this is a new idea for ideas.arcgis.com to access a mapservice name (not the TOC name that can change) with python scripting as it does not seem possible at this point.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Oct 2013 17:48:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/need-to-replace-out-of-date-map-services-in-mxds/m-p/616033#M48073</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2013-10-15T17:48:26Z</dc:date>
    </item>
  </channel>
</rss>

