<?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: Is there a way to automatically change an MXD data source to a hosted feature service on AGO? in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/is-there-a-way-to-automatically-change-an-mxd-data/m-p/104203#M4956</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rebecca, I will take a look at the addin soon.&amp;nbsp; If it doesn't do the trick for AGO, at the very least the addin looks helpful for other data source issues.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Oct 2015 19:40:15 GMT</pubDate>
    <dc:creator>BrianFausel</dc:creator>
    <dc:date>2015-10-27T19:40:15Z</dc:date>
    <item>
      <title>Is there a way to automatically change an MXD data source to a hosted feature service on AGO?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/is-there-a-way-to-automatically-change-an-mxd-data/m-p/104201#M4954</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have found &lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00s30000004p000000" rel="nofollow noopener noreferrer" target="_blank"&gt;some very useful solutions&lt;/A&gt; to change MXD data sources using python.&amp;nbsp; The question: Is it possible to automatically switch MXD data sources to an AGO-hosted feature service?&amp;nbsp; It seems that the replaceDataSource() method would work, but there does not appear to be a &lt;A href="http://resources.arcgis.com/en/help/main/10.2/#/Layer/00s300000008000000/" rel="nofollow noopener noreferrer" target="_blank"&gt;workspace_type&lt;/A&gt; for AGO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The added challenge here is that the feature class names change - the original file GDB uses the full name (i.e. "Major_Employers") and on AGO the name becomes the number for the REST service (i.e. "0").&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried modifying the python example "&lt;A href="http://resources.arcgis.com/en/help/main/10.2/index.html#//00s30000004p000000" rel="nofollow noopener noreferrer" target="_blank"&gt;A feature class is renamed" from the Esri help document&lt;/A&gt; and it didn't work.&amp;nbsp; Before I move forward with troubleshooting this code, my main question is can this be done in the first place?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note: I modified the AGO URL in my code example below to remove specifics:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\temp\MXD_Update\Data_Source_Update.mxd")
for lyr in arcpy.mapping.ListLayers(mxd):
&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.supports("DATASOURCE"):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if lyr.dataSource == r"C:\temp\MXD_Update\AGO_Sync_Testing.gdb\Major_Employers":
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.replaceDataSource(r"&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fservices2.arcgis.com%2F%5Burl%5D%2FArcGIS%2Frest%2Fservices%2F%5Bfeatureservicename%5D%2FFeatureServer" target="_blank"&gt;http://services2.arcgis.com/[url]/ArcGIS/rest/services/[featureservicename]/FeatureServer&lt;/A&gt;&lt;SPAN&gt;", "NONE", "0")&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lyr.name = "0"
mxd.saveACopy(r"C:\temp\MXD_Update\Data_Source_Update_AGO.mxd")
del mxd&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:23:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/is-there-a-way-to-automatically-change-an-mxd-data/m-p/104201#M4954</guid>
      <dc:creator>BrianFausel</dc:creator>
      <dc:date>2021-12-11T06:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to automatically change an MXD data source to a hosted feature service on AGO?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/is-there-a-way-to-automatically-change-an-mxd-data/m-p/104202#M4955</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Brian, I have an addin that lets you replace ArcGIS Server service URL's....I wonder if it is a similar process?&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migration-blogpost/55043"&gt;Python addin for data inventory and “broken-link” repair.&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not tried replacing, but looking at the code in the addin might give you some clues.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Oct 2015 17:44:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/is-there-a-way-to-automatically-change-an-mxd-data/m-p/104202#M4955</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2015-10-27T17:44:44Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to automatically change an MXD data source to a hosted feature service on AGO?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/is-there-a-way-to-automatically-change-an-mxd-data/m-p/104203#M4956</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rebecca, I will take a look at the addin soon.&amp;nbsp; If it doesn't do the trick for AGO, at the very least the addin looks helpful for other data source issues.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Oct 2015 19:40:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/is-there-a-way-to-automatically-change-an-mxd-data/m-p/104203#M4956</guid>
      <dc:creator>BrianFausel</dc:creator>
      <dc:date>2015-10-27T19:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a way to automatically change an MXD data source to a hosted feature service on AGO?</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/is-there-a-way-to-automatically-change-an-mxd-data/m-p/104204#M4957</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm have a newer version, but not ready to post (no time to work on it right now). But if you find it helpful, you can follow the blog page I think.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you find the code just needs a little tweak of some type to get it to work with AGOL, let me know.&amp;nbsp; It would be good to add that in.&amp;nbsp; If it can't be done at all, it sounds like somehting that should be added on the &lt;A href="http://ideas.arcgis.com/" title="http://ideas.arcgis.com/"&gt;Esri Arcgis Ideas | Ideas Submission Portal&lt;/A&gt; page&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Oct 2015 19:45:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/is-there-a-way-to-automatically-change-an-mxd-data/m-p/104204#M4957</guid>
      <dc:creator>RebeccaStrauch__GISP</dc:creator>
      <dc:date>2015-10-27T19:45:07Z</dc:date>
    </item>
  </channel>
</rss>

