<?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: updateConnectionProperties is breaking all other layers in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/updateconnectionproperties-is-breaking-all-other/m-p/1033731#M60269</link>
    <description>&lt;P&gt;What is ListFeatureClasses() doing, and subsequent loop?&lt;/P&gt;</description>
    <pubDate>Sat, 06 Mar 2021 21:21:58 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2021-03-06T21:21:58Z</dc:date>
    <item>
      <title>updateConnectionProperties is breaking all other layers</title>
      <link>https://community.esri.com/t5/python-questions/updateconnectionproperties-is-breaking-all-other/m-p/1033728#M60267</link>
      <description>&lt;P&gt;I have an issue that has me pretty stumped. I'm writing a script that is taking powerline information, replacing a layers source data in a map, kicking out a new aprx then creating tile packages from the aprx.&amp;nbsp;&lt;/P&gt;&lt;P&gt;What's happening is that when updateConnectionProperties is fired off on the conductor layer, its breaking all the other layers and their source data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Has any one else experienced this before?&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have included the section of my script below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;arcpy.env.workspace = circuitGDB
aprx = arcpy.mp.ArcGISProject(aprxFile)

for featureClasses in arcpy.ListFeatureClasses():

    #print(featureClasses)

    for map in aprx.listMaps():
        if map.name == "Layers":
            for layers in map.listLayers():
                #print(map.name)
                #print(layers)
                
                if str(layers) == "Conductor":
                    print("Found The Conductor Layer")
                    print("\nThe original connection properties is:")

                    connDict = {'connection_info': {'database': circuitGDB},
                                'dataset': featureClasses,
                                'workspace_factory': 'File Geodatabase'}
                    
                    currConnProp = layers.connectionProperties
                    pprint.pprint(currConnProp)

                    layers.updateConnectionProperties(current_connection_info=currConnProp,
                                                      new_connection_info=connDict)
                    
                    aprx.saveACopy(editedAPRXFileLoc + "\\" + featureClasses + ".aprx")

                    print("Updated the Datat Source and saved new aprx for circuit : ")
                    print(featureClasses)
                    print("----------------------------------------------------------------")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Mar 2021 19:50:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updateconnectionproperties-is-breaking-all-other/m-p/1033728#M60267</guid>
      <dc:creator>JeremyMoore2</dc:creator>
      <dc:date>2021-03-06T19:50:51Z</dc:date>
    </item>
    <item>
      <title>Re: updateConnectionProperties is breaking all other layers</title>
      <link>https://community.esri.com/t5/python-questions/updateconnectionproperties-is-breaking-all-other/m-p/1033729#M60268</link>
      <description>&lt;P&gt;Are you trying to update the connection properties of the other layers in the aprx or are they supposed to be left intact?&lt;/P&gt;</description>
      <pubDate>Sat, 06 Mar 2021 21:02:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updateconnectionproperties-is-breaking-all-other/m-p/1033729#M60268</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2021-03-06T21:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: updateConnectionProperties is breaking all other layers</title>
      <link>https://community.esri.com/t5/python-questions/updateconnectionproperties-is-breaking-all-other/m-p/1033731#M60269</link>
      <description>&lt;P&gt;What is ListFeatureClasses() doing, and subsequent loop?&lt;/P&gt;</description>
      <pubDate>Sat, 06 Mar 2021 21:21:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/updateconnectionproperties-is-breaking-all-other/m-p/1033731#M60269</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-03-06T21:21:58Z</dc:date>
    </item>
  </channel>
</rss>

