<?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 Publishing layers to AGOLE in ArcGIS Online Questions</title>
    <link>https://community.esri.com/t5/arcgis-online-questions/publishing-layers-to-agole/m-p/1004646#M37509</link>
    <description />
    <pubDate>Tue, 01 Dec 2020 11:02:40 GMT</pubDate>
    <dc:creator>inolaroch</dc:creator>
    <dc:date>2020-12-01T11:02:40Z</dc:date>
    <item>
      <title>Publishing layers to AGOLE</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/publishing-layers-to-agole/m-p/1004646#M37509</link>
      <description />
      <pubDate>Tue, 01 Dec 2020 11:02:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/publishing-layers-to-agole/m-p/1004646#M37509</guid>
      <dc:creator>inolaroch</dc:creator>
      <dc:date>2020-12-01T11:02:40Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing layers to AGOLE</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/publishing-layers-to-agole/m-p/1004655#M37512</link>
      <description>&lt;P&gt;Per the &lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/mapping/map-class.htm" target="_self"&gt;ArcPy docs&lt;/A&gt;, the &lt;STRONG&gt;getWebLayerSharingDraft&lt;/STRONG&gt; method takes an optional parameter &lt;STRONG&gt;layers_and_tables&lt;/STRONG&gt;.&lt;/P&gt;&lt;BLOCKQUOTE&gt;A list of layers and tables from the map. If left blank, the entire map will be published. This parameter allows you to choose a subset of layers and tables from the map to publish. The layers and tables must be from the same map that is being published.&lt;/BLOCKQUOTE&gt;&lt;P&gt;Since you already have your map as the object &lt;STRONG&gt;m&lt;/STRONG&gt;, you just need to call &lt;STRONG&gt;m.listLayers()&lt;/STRONG&gt; to retrieve the list of layers in your map.&lt;/P&gt;&lt;P&gt;With that, you could easily nest your existing code in a &lt;STRONG&gt;for&lt;/STRONG&gt; loop, somewhat like this:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;lyrs = m.listLayers()

for lyr in lyrs:
    service = lyr.name
    sharing_draft = m.getWebLayerSharingDraft("HOSTING_SERVER", "FEATURE", service, lyr)
    ...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Note that the variable &lt;STRONG&gt;service&lt;/STRONG&gt; has to be defined&amp;nbsp;&lt;EM&gt;inside&lt;/EM&gt; the loop, otherwise each layer will attempt to publish with the same service name.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 14:12:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/publishing-layers-to-agole/m-p/1004655#M37512</guid>
      <dc:creator>jcarlson</dc:creator>
      <dc:date>2020-11-25T14:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing layers to AGOLE</title>
      <link>https://community.esri.com/t5/arcgis-online-questions/publishing-layers-to-agole/m-p/1005024#M37533</link>
      <description>&lt;P&gt;Thank you Mr Carlson for your help i will try it.&lt;/P&gt;&lt;P&gt;Kind Regards,&lt;/P&gt;</description>
      <pubDate>Thu, 26 Nov 2020 14:08:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-online-questions/publishing-layers-to-agole/m-p/1005024#M37533</guid>
      <dc:creator>inolaroch</dc:creator>
      <dc:date>2020-11-26T14:08:21Z</dc:date>
    </item>
  </channel>
</rss>

