AnsweredAssumed Answered

Sharing Options for Python Map Image Layer Automation

Question asked by CooperKey on Mar 22, 2020
Latest reply on Mar 23, 2020 by CooperKey

Having been referred to the overwrite option for sharing a map image layer in python, I am wondering if there is an option to allow for sharing with a group or, within the organization or, with everyone.  In the documentation for the method, there does not seem to be a sharing parameter option.  I was thinking about a solution like where I search for the layer and then update the parameter was  available option if there is no method in the other sharing option.  However i cannot get this code to actually update that parameter.   Here is the code I am trying:

 

 

from arcgis.gis import GIS
portal = "https://sdc01acgicpw01s.corp.company.com/portal/home/content.html"
user = "      "
password = "     "
service = "WebUpdate"
gis = GIS(portal, user, password)
print("Search for original SD on portal…")
search_results = gis.content.search("{} AND owner:{}".format(service, user), item_type="Map Image Layer")[0]
print("Found SD: {}, ID: {} ".format(search_results.title, search_results.id))
feature_layer_item = search_results[0]
print("Setting sharing options…")
feature_layer_item.share(everyone=True)
print("Finished updating: {} – ID: {}".format(feature_layer_item.title, feature_layer_item.id))

 

Anything I can do to through code to change the sharing for a map image layer?

Outcomes