<?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: Sharing not working on script in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/sharing-not-working-on-script/m-p/1341617#M69031</link>
    <description>&lt;P&gt;Thanks Carsten, I thought of that, but I actually found a work around!&lt;/P&gt;</description>
    <pubDate>Wed, 25 Oct 2023 19:32:10 GMT</pubDate>
    <dc:creator>AngelaSchirck</dc:creator>
    <dc:date>2023-10-25T19:32:10Z</dc:date>
    <item>
      <title>Sharing not working on script</title>
      <link>https://community.esri.com/t5/python-questions/sharing-not-working-on-script/m-p/1341114#M69023</link>
      <description>&lt;P&gt;I have built a tool that uploads/overwrites hosted feature layers on enterprise portal on a weekly basis.&amp;nbsp; The tool works fine, but the share with organization is not being recognized.&amp;nbsp; The UploadServiceDefinition help states you must be signed into portal, so I included portal sign in in my script.&lt;/P&gt;&lt;P&gt;I set the in_organization parameter to "SHARE_ORGANIZATION" however, when my model runs it is not sharing with the organization.&lt;/P&gt;&lt;P&gt;This image shows my script successfully ran and I was signed into portal, and my sharing parameter was correctly set to SHARE_ORGANIZATION:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AngelaSchirck_0-1698177093772.png" style="width: 661px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/83864i94350BB09FE05A38/image-dimensions/661x362?v=v2" width="661" height="362" role="button" title="AngelaSchirck_0-1698177093772.png" alt="AngelaSchirck_0-1698177093772.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;the actual script collects the parameter as input in a variable called share_organization (which can be set to SHARE_ORGANIZATION or NO_SHARE_ORGANIZATION per the ESRI documentation).&lt;/P&gt;&lt;P&gt;The upload command is here (uses the else clause in this particular case):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AngelaSchirck_1-1698177246835.png" style="width: 793px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/83865iAA559E6A8091E24B/image-dimensions/793x75?v=v2" width="793" height="75" role="button" title="AngelaSchirck_1-1698177246835.png" alt="AngelaSchirck_1-1698177246835.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Parameters collected here:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AngelaSchirck_2-1698177327206.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/83866i09CC247DEF537E96/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AngelaSchirck_2-1698177327206.png" alt="AngelaSchirck_2-1698177327206.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I've been wracking my brain over this one...I have a similar script that publishes referenced registered data with similar settings and the share with organization part of the script (identical to this only on a federated server) works fine there.&lt;/P&gt;&lt;P&gt;Anybody have any idea why this is not working!?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 19:57:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sharing-not-working-on-script/m-p/1341114#M69023</guid>
      <dc:creator>AngelaSchirck</dc:creator>
      <dc:date>2023-10-24T19:57:27Z</dc:date>
    </item>
    <item>
      <title>Re: Sharing not working on script</title>
      <link>https://community.esri.com/t5/python-questions/sharing-not-working-on-script/m-p/1341455#M69030</link>
      <description>&lt;P&gt;Hi Angela,&lt;/P&gt;&lt;P&gt;A quick suggestion: Maybe the parameter is a string with the value 'true' or 'false' and the method expects a boolean?&lt;/P&gt;&lt;P&gt;You could try GetParameter instead of GetParameterAsText or convert the input to a boolean?&lt;/P&gt;&lt;P&gt;Something like this has thrown me off before!&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Carsten&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 15:36:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sharing-not-working-on-script/m-p/1341455#M69030</guid>
      <dc:creator>CarstenB_orsted</dc:creator>
      <dc:date>2023-10-25T15:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: Sharing not working on script</title>
      <link>https://community.esri.com/t5/python-questions/sharing-not-working-on-script/m-p/1341617#M69031</link>
      <description>&lt;P&gt;Thanks Carsten, I thought of that, but I actually found a work around!&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 19:32:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sharing-not-working-on-script/m-p/1341617#M69031</guid>
      <dc:creator>AngelaSchirck</dc:creator>
      <dc:date>2023-10-25T19:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Sharing not working on script</title>
      <link>https://community.esri.com/t5/python-questions/sharing-not-working-on-script/m-p/1341629#M69032</link>
      <description>&lt;P&gt;Okay, So for those who want to know, I found a work-around here that allows me to share with the organization (without the portal sign-on).&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the script, after it created the sddraft, I simply opened it and changed the parameter to true using the following code (if share organization is equal to SHARE_ORGANIZATION execute the function):&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;&lt;P&gt;import xml.dom.minidom as DOM&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;def changeShare(sddraftPath):&lt;BR /&gt;# Read the sddraft xml.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; doc = DOM.parse(sddraftPath)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; properties = doc.getElementsByTagName('PropertySetProperty')&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for property in properties:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; key = property.firstChild.firstChild.data&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try:&lt;BR /&gt;&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 key == 'PackageUnderMyOrg':&lt;BR /&gt;&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; property.firstChild.nextSibling.firstChild.data = 'true'&lt;BR /&gt;&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; break&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; except:&lt;BR /&gt;&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; continue&lt;/P&gt;&lt;P&gt;# Write to sddraft&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f = open(sddraftPath, 'w')&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; doc.writexml(f)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; f.close()&lt;/P&gt;&lt;P&gt;```&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 19:42:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/sharing-not-working-on-script/m-p/1341629#M69032</guid>
      <dc:creator>AngelaSchirck</dc:creator>
      <dc:date>2023-10-25T19:42:25Z</dc:date>
    </item>
  </channel>
</rss>

