<?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: Publishing map to ArcGIS Server (10.6+) with Python - Conundrum! in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860386#M4161</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, so after working on &lt;A _jive_internal="true" href="https://community.esri.com/thread/228783-how-to-assign-name-to-map-layer-in-aprx-when-importing-from-mxd" target="_blank"&gt;this here&lt;/A&gt;&amp;nbsp;post about recycling MXD for publishing with Pro, I've revisited the publishing script and found that the &lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/sharing/mapimagesharingdraft-class.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;sample given here&lt;/A&gt; works on my end after all. Here is my slightly revised version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os

&lt;SPAN class="comment token"&gt;# Set output file names&lt;/SPAN&gt;
outdir &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\temp"&lt;/SPAN&gt;
service &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"MyServiceName"&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# -- this in my case would be same/similar to name below called &amp;lt;This_is_the_name_of_maplayer&amp;gt;&lt;/SPAN&gt;
sddraft_filename &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; service &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;".sddraft"&lt;/SPAN&gt;
sddraft_output_filename &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outdir&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sddraft_filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

my_federated_server &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"https://server.domain.com/webadaptor"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Reference map to publish&lt;/SPAN&gt;
aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;path_aprx_with_maps&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
m &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;This_is_the_name_of_maplayer&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Create MapImageSharingDraft and set service properties&lt;/SPAN&gt;
sharing_draft &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; m&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getWebLayerSharingDraft&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"FEDERATED_SERVER"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"MAP_IMAGE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; service&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# The following will be good practice definitely&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# But I ignored it for this test&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#sharing_draft.federatedServerUrl = my_federated_server &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#sharing_draft.summary = "My Summary"&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#sharing_draft.tags = "My Tags"&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#sharing_draft.description = "My Description"&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#sharing_draft.credits = "My Credits"&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#sharing_draft.useLimitations = "My Use Limitations"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Create Service Definition Draft file&lt;/SPAN&gt;
sharing_draft&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;exportToSDDraft&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sddraft_output_filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Stage Service&lt;/SPAN&gt;
sd_filename &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; service &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;".sd"&lt;/SPAN&gt;
sd_output_filename &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outdir&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sd_filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;StageService_server&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sddraft_output_filename&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sd_output_filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Share to portal&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Uploading Service Definition..."&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UploadServiceDefinition_server&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sd_output_filename&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; my_federated_server &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Successfully Uploaded service."&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 10:39:50 GMT</pubDate>
    <dc:creator>Arne_Gelfert</dc:creator>
    <dc:date>2021-12-12T10:39:50Z</dc:date>
    <item>
      <title>Publishing map to ArcGIS Server (10.6+) with Python - Conundrum!</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860385#M4160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey all,&lt;/P&gt;&lt;P&gt;I'm caught in ESRI's library-name-change-and-circularly-referencing-documentation hell.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a number of MXD's that were the basis for a number ArcGIS map services in a 10.5.x standalone ArcGIS Server environment. I would like to publish these in a new federated ArcGIS Server environment (ArcGIS Enterprise).&lt;BR /&gt;How do I script that? Seems like that should be easy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The older documentation suggests the following steps, which ring familiar...&amp;nbsp;(&lt;A class="link-titled" href="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/createmapsddraft.htm" title="http://desktop.arcgis.com/en/arcmap/latest/analyze/arcpy-mapping/createmapsddraft.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;CreateMapSDDraft—Help | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;)&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;arcpy.mapping.MapDocument( )
arcpy.mapping.CreateMapSDDraft( )
arcpy.StageService_server( )
arcpy.UploadServiceDefinition_server( )&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;But it turns out I don't have 'arcpy.mapping' module anymore.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="" style="color: #b22b31; font-weight: bold;"&gt;AttributeError&lt;/SPAN&gt;: module 'arcpy' has no attribute 'mapping'&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P style="color: #000000; background-color: #ffffff; border: 0px; font-size: 14px; padding: 1px 0px;"&gt;Where did it go? It's been replaced with arc.mp. Huge semantic improvement!! But it's not like that's just a&amp;nbsp;new name:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN class="" style="color: #b22b31; font-weight: bold;"&gt;AttributeError&lt;/SPAN&gt;: module 'arcpy.mp' has no attribute 'CreateMapSDDraft'&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Well, publishing from MXD is no longer cool anyways. ESRI apparently wants you to live in the APRX world. So I "converted" an MXD to APRX to try another approach.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;You'd think now you could use the following (&lt;A class="link-titled" href="http://pro.arcgis.com/en/pro-app/arcpy/sharing/createsharingdraft.htm" title="http://pro.arcgis.com/en/pro-app/arcpy/sharing/createsharingdraft.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;CreateSharingDraft—Sharing module | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;EM&gt;&lt;STRONG&gt;CreateSharingDraft - function&lt;/STRONG&gt; &lt;/EM&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #0000ff;"&gt;"&lt;EM&gt;The CreateSharingDraft function creates a MapServiceDraft from a Map in an ArcGIS Pro project that can be configured and shared to ArcGIS Server.&lt;/EM&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;service_draft = arcpy.sharing.CreateSharingDraft( )
service_draft.exportToSDDraft( )
arcpy.StageService_server( )
arcpy.UploadServiceDefinition_server( )&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;No!&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #ff0000;"&gt;AttributeError: &lt;SPAN style="color: #000000;"&gt;module 'arcpy.sharing' has no attribute 'CreateSharingDraft'&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;What the heck???&lt;/PRE&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;sharing_draft = m.getWebLayerSharingDraft( )
sharing_draft.exportToSDDraft( )
arcpy.StageService_server( )
arcpy.UploadServiceDefinition_server( )&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Using these steps, the code fails at&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;sharing_draft = m.getWebLayerSharingDraft("FEDERATED_SERVER", "MAP_IMAGE", service)
sharing_draft.exportToSDDraft(sddraft_output_filename)

&lt;SPAN class="" style="color: #b22b31; font-weight: bold;"&gt;ValueError&lt;/SPAN&gt;: MAP_IMAGE&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Is it possible that I've missed the one page in the&amp;nbsp;documentation that makes sense? Please let me know. All I want to do is iterate over some directories with MXD files and publish them as map services.&lt;/P&gt;&lt;P&gt;UPDATE: I had a&amp;nbsp;hunch that with multiple ESRI associated Python installs, one might offer the old arc.mapping. So looks like ArcMap's old Py2.7 still has it. Didn't think about that earlier because I'm working almost exclusively in Jupyter Notebook. Whether this is&amp;nbsp;of much help, I don't know. Can't imagine going back and forth between releases.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="image-1 jive-image j-img-original" src="https://community.esri.com/legacyfs/online/436594_arcpymapping.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 17:00:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860385#M4160</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2021-12-12T17:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing map to ArcGIS Server (10.6+) with Python - Conundrum!</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860386#M4161</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, so after working on &lt;A _jive_internal="true" href="https://community.esri.com/thread/228783-how-to-assign-name-to-map-layer-in-aprx-when-importing-from-mxd" target="_blank"&gt;this here&lt;/A&gt;&amp;nbsp;post about recycling MXD for publishing with Pro, I've revisited the publishing script and found that the &lt;A href="https://pro.arcgis.com/en/pro-app/arcpy/sharing/mapimagesharingdraft-class.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;sample given here&lt;/A&gt; works on my end after all. Here is my slightly revised version.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; arcpy
&lt;SPAN class="keyword token"&gt;import&lt;/SPAN&gt; os

&lt;SPAN class="comment token"&gt;# Set output file names&lt;/SPAN&gt;
outdir &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; r&lt;SPAN class="string token"&gt;"C:\temp"&lt;/SPAN&gt;
service &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"MyServiceName"&lt;/SPAN&gt;  &lt;SPAN class="comment token"&gt;# -- this in my case would be same/similar to name below called &amp;lt;This_is_the_name_of_maplayer&amp;gt;&lt;/SPAN&gt;
sddraft_filename &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; service &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;".sddraft"&lt;/SPAN&gt;
sddraft_output_filename &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outdir&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sddraft_filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

my_federated_server &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"https://server.domain.com/webadaptor"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Reference map to publish&lt;/SPAN&gt;
aprx &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mp&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;ArcGISProject&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;path_aprx_with_maps&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
m &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; aprx&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;listMaps&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt;This_is_the_name_of_maplayer&lt;SPAN class="operator token"&gt;&amp;gt;&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Create MapImageSharingDraft and set service properties&lt;/SPAN&gt;
sharing_draft &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; m&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;getWebLayerSharingDraft&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"FEDERATED_SERVER"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"MAP_IMAGE"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; service&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# The following will be good practice definitely&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;# But I ignored it for this test&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#sharing_draft.federatedServerUrl = my_federated_server &lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#sharing_draft.summary = "My Summary"&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#sharing_draft.tags = "My Tags"&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#sharing_draft.description = "My Description"&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#sharing_draft.credits = "My Credits"&lt;/SPAN&gt;
&lt;SPAN class="comment token"&gt;#sharing_draft.useLimitations = "My Use Limitations"&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Create Service Definition Draft file&lt;/SPAN&gt;
sharing_draft&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;exportToSDDraft&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sddraft_output_filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Stage Service&lt;/SPAN&gt;
sd_filename &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; service &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;".sd"&lt;/SPAN&gt;
sd_output_filename &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; os&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;path&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;join&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;outdir&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sd_filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;StageService_server&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sddraft_output_filename&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; sd_output_filename&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="comment token"&gt;# Share to portal&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Uploading Service Definition..."&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;
arcpy&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;UploadServiceDefinition_server&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;sd_output_filename&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; my_federated_server &lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;

&lt;SPAN class="keyword token"&gt;print&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"Successfully Uploaded service."&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:39:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860386#M4161</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2021-12-12T10:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing map to ArcGIS Server (10.6+) with Python - Conundrum!</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860387#M4162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you need to publish MXDs directly, then this documentation should still be valid: &lt;A class="link-titled" href="http://enterprise.arcgis.com/en/server/latest/administer/windows/example-publish-a-map-service-from-a-map-document-mxd-.htm" title="http://enterprise.arcgis.com/en/server/latest/administer/windows/example-publish-a-map-service-from-a-map-document-mxd-.htm"&gt;Example: Publish a map service from a map document (MXD)—ArcGIS Server Administration (Windows) | ArcGIS Enterprise&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2019 17:38:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860387#M4162</guid>
      <dc:creator>EarlMedina</dc:creator>
      <dc:date>2019-02-13T17:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing map to ArcGIS Server (10.6+) with Python - Conundrum!</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860388#M4163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, Earl.... if you saw my initial post you noticed I was trying to work with one version of arcpy, and mine only had arcpy.mp, which doesn't work quite the same way. I did get it to work in the older version running in Python 2.7. All in all, I was really trying an ArcGIS Pro centric approach. Getting used to working with APRX instead of&amp;nbsp;MXD. Thanksa for chiming in though.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Feb 2019 18:59:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860388#M4163</guid>
      <dc:creator>Arne_Gelfert</dc:creator>
      <dc:date>2019-02-13T18:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing map to ArcGIS Server (10.6+) with Python - Conundrum!</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860389#M4164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi - I get an error on line 28 (exportToSDDraft) on my setup saying "missing target server" -&amp;nbsp;there is no place to set the target server - we have both a&amp;nbsp; /server site and a /image federated with our portal. Can see why code above is confused - nothing is setting which server to publish too - ideas?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jul 2019 05:42:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860389#M4164</guid>
      <dc:creator>GNOMICAdmin</dc:creator>
      <dc:date>2019-07-15T05:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing map to ArcGIS Server (10.6+) with Python - Conundrum!</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860390#M4165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was just reviewing documentation for these same issues and noticed that the CreateSharingDraft(&lt;A class="link-titled" href="https://pro.arcgis.com/en/pro-app/arcpy/sharing/createsharingdraft.htm" title="https://pro.arcgis.com/en/pro-app/arcpy/sharing/createsharingdraft.htm"&gt;CreateSharingDraft—Sharing module | ArcGIS Desktop&lt;/A&gt;&amp;nbsp;) example shows how you set targetServer on the service draft object. Maybe that will help you out with that error.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Aug 2019 16:44:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860390#M4165</guid>
      <dc:creator>StephenPatterson1</dc:creator>
      <dc:date>2019-08-07T16:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing map to ArcGIS Server (10.6+) with Python - Conundrum!</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860391#M4166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;that example is for a standalone server - one that is not federated with Portal. So when I run that it complains that the target server is not a standalone server - which is correct - its federated with portal. And yet when I use the federated option above I get the missing target server error. So either way I get an error that something is missing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So now I need to figure out what i'm missing &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Aug 2019 05:46:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860391#M4166</guid>
      <dc:creator>GNOMICAdmin</dc:creator>
      <dc:date>2019-08-16T05:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: Publishing map to ArcGIS Server (10.6+) with Python - Conundrum!</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860392#M4167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the missing link was to un-comment this line&amp;nbsp;&lt;/P&gt;&lt;PRE class="" style="color: #000000; background: #f5f2f0; border: 0px; font-size: 14px; margin: 0.5em 0px; padding: 1em 1em 1em 3.8em;"&gt;&lt;CODE style="border: 0px; font-weight: inherit; font-size: 14px;"&gt;&lt;SPAN class="" style="color: slategray; border: 0px; font-weight: inherit; font-size: 14px;"&gt;sharing_draft.federatedServerUrl = my_federated_server&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Aug 2019 06:00:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/publishing-map-to-arcgis-server-10-6-with-python/m-p/860392#M4167</guid>
      <dc:creator>GNOMICAdmin</dc:creator>
      <dc:date>2019-08-16T06:00:44Z</dc:date>
    </item>
  </channel>
</rss>

