from arcgis.gis import GIS
# Replace 'username' and 'password' with your ArcGIS Online credentials
gis = GIS("home", "username", "password")
# Replace 'item_id' with the ID of the item you want to update
item_id = 'item_id'
# Replace 'sharing_level' with the desired sharing level ('private', 'organization', 'public')
sharing_level = 'public'
# Get the item
item = gis.content.get(item_id)
# Update the sharing level
item.share(everyone=True, org=True if sharing_level == 'organization' else False, groups='')
print(f"Sharing level of item {item_id} set to {sharing_level}") https://developers.arcgis.com/documentation/portal-and-data-services/portal-service/sharing/sharing-items/
... View more