<?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 getWebLayerSharingDraft - sharing to a group? in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/getweblayersharingdraft-sharing-to-a-group/m-p/1593714#M93798</link>
    <description>&lt;P&gt;Does anyone know of a problem or bug getting&amp;nbsp;&lt;STRONG&gt;getWebLayerSharingDraft&lt;/STRONG&gt; to share to a defined group on ArcGIS Online using arcpy, as shipped with ArcGIS Pro 3.4.2.&lt;/P&gt;&lt;P&gt;My code effectively has a single group:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="courier new,courier"&gt;sddraft.sharing.groups = "Flood Modeling - Working GP"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;The service is being successfully published, but it has not been shared with the specified group. I'm not seeing any errors or warnings.&lt;/P&gt;&lt;P&gt;Is there a bug?&amp;nbsp; A problem with spaces or hyphens?&amp;nbsp; Does it need to be a Python &lt;EM&gt;list&lt;/EM&gt;?&amp;nbsp; &amp;nbsp;Are any other parameters causing a conflict? Unicode?&lt;BR /&gt;&lt;BR /&gt;If the service exists, the overwriting is honoured, but the new item is effectively unshared when the overwrite occurs.&lt;/P&gt;&lt;P&gt;Here is a snippet of my code :&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;&lt;LI-CODE lang="python"&gt;# Set publishing metadata and parameters
    service_type = "FEATURE"
    service_name = map_name

    credits = "X, Y"
    description = f"{map_name}.IFC"
    summary = f"Published by MZ {timestamp}"
    tags = "TEST"
    useLimitations = "None"
    portalFolder = "IFC_FL"
    featureCapabilities = "Query"
    useCIMSymbols = False  # most compatabile
    sharingLevel = "OWNER"
    groups = "Flood Modeling - Working GP"
    offline = True
    offlineTarget = "ONLINE"
    overwriteExistingService = True

    try:
        aprx = arcpy.mp.ArcGISProject(aprx_path)
        map_obj = aprx.listMaps(map_name)[0]
        sddraft = map_obj.getWebLayerSharingDraft(server_type, service_type, service_name)

        # update sdraft parameter values
        sddraft.credits = credits
        sddraft.description = description
        sddraft.summary = summary
        sddraft.tags = tags
        sddraft.useLimitations = useLimitations
        sddraft.portalFolder = portalFolder
        sddraft.featureCapabilities = featureCapabilities
        sddraft.useCIMSymbols = useCIMSymbols
        sddraft.sharing.sharingLevel = sharingLevel
        sddraft.sharing.groups = groups
        sddraft.offlineTarget = offlineTarget
        sddraft.overwriteExistingService = overwriteExistingService
        sddraft.offline = offline

        # Export, Stage &amp;amp; Upload
        sddraft.exportToSDDraft(sddraft_path)
        arcpy.server.StageService(sddraft_path, sd_path)
        arcpy.server.UploadServiceDefinition(sd_path, server_type)&lt;/LI-CODE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Mar 2025 06:03:49 GMT</pubDate>
    <dc:creator>MicZatorsky_AEC</dc:creator>
    <dc:date>2025-03-10T06:03:49Z</dc:date>
    <item>
      <title>getWebLayerSharingDraft - sharing to a group?</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/getweblayersharingdraft-sharing-to-a-group/m-p/1593714#M93798</link>
      <description>&lt;P&gt;Does anyone know of a problem or bug getting&amp;nbsp;&lt;STRONG&gt;getWebLayerSharingDraft&lt;/STRONG&gt; to share to a defined group on ArcGIS Online using arcpy, as shipped with ArcGIS Pro 3.4.2.&lt;/P&gt;&lt;P&gt;My code effectively has a single group:&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;FONT face="courier new,courier"&gt;sddraft.sharing.groups = "Flood Modeling - Working GP"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;The service is being successfully published, but it has not been shared with the specified group. I'm not seeing any errors or warnings.&lt;/P&gt;&lt;P&gt;Is there a bug?&amp;nbsp; A problem with spaces or hyphens?&amp;nbsp; Does it need to be a Python &lt;EM&gt;list&lt;/EM&gt;?&amp;nbsp; &amp;nbsp;Are any other parameters causing a conflict? Unicode?&lt;BR /&gt;&lt;BR /&gt;If the service exists, the overwriting is honoured, but the new item is effectively unshared when the overwrite occurs.&lt;/P&gt;&lt;P&gt;Here is a snippet of my code :&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;&lt;LI-CODE lang="python"&gt;# Set publishing metadata and parameters
    service_type = "FEATURE"
    service_name = map_name

    credits = "X, Y"
    description = f"{map_name}.IFC"
    summary = f"Published by MZ {timestamp}"
    tags = "TEST"
    useLimitations = "None"
    portalFolder = "IFC_FL"
    featureCapabilities = "Query"
    useCIMSymbols = False  # most compatabile
    sharingLevel = "OWNER"
    groups = "Flood Modeling - Working GP"
    offline = True
    offlineTarget = "ONLINE"
    overwriteExistingService = True

    try:
        aprx = arcpy.mp.ArcGISProject(aprx_path)
        map_obj = aprx.listMaps(map_name)[0]
        sddraft = map_obj.getWebLayerSharingDraft(server_type, service_type, service_name)

        # update sdraft parameter values
        sddraft.credits = credits
        sddraft.description = description
        sddraft.summary = summary
        sddraft.tags = tags
        sddraft.useLimitations = useLimitations
        sddraft.portalFolder = portalFolder
        sddraft.featureCapabilities = featureCapabilities
        sddraft.useCIMSymbols = useCIMSymbols
        sddraft.sharing.sharingLevel = sharingLevel
        sddraft.sharing.groups = groups
        sddraft.offlineTarget = offlineTarget
        sddraft.overwriteExistingService = overwriteExistingService
        sddraft.offline = offline

        # Export, Stage &amp;amp; Upload
        sddraft.exportToSDDraft(sddraft_path)
        arcpy.server.StageService(sddraft_path, sd_path)
        arcpy.server.UploadServiceDefinition(sd_path, server_type)&lt;/LI-CODE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Mar 2025 06:03:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/getweblayersharingdraft-sharing-to-a-group/m-p/1593714#M93798</guid>
      <dc:creator>MicZatorsky_AEC</dc:creator>
      <dc:date>2025-03-10T06:03:49Z</dc:date>
    </item>
  </channel>
</rss>

