Hey all, I am trying to create a notebook that will look at how layers are shared in a few webmaps and (later down the line) send me a message when things are throwing errors or not shared properly. However, I am running into the 403 error saying "You do not have permissions to access this resource or perform this operation" even though I both own the layer and am an admin for my AGOL organization. Any ideas on what could be causing this? Just making a try/except to skip it isn't an option for that I need the script to do in the end.
from arcgis.gis import GIS
import datetime as dt
import time
from arcgis.gis import GIS
from arcgis.mapping import WebMap
gis = GIS('home')
intelmanagerMap = gis.content.get("904575e13cf04ebfb9bdfc4ee0f48cbb")
wm=WebMap(intelmanagerMap)
for lyr in wm.layers:
try:
lyr_item = gis.content.get(lyr.itemId)
print(f"{lyr_item.title} shared with {lyr_item.shared_with}\n")
except Exception as e:
print(f"Something is wrong with {lyr.title}. Exception thrown: {e}\n")
output:
SARCOP Tasks v1 - debd1c shared with {'everyone': True, 'org': True, 'groups': []}
ee24a9 Sandbox v9 SIFS Intel Manager 1.0 View shared with {'everyone': True, 'org': True, 'groups': [<Group title:"SARCOP Sandbox v9 - 38f775" owner:afackler_napsg>]}
ee24a9 Sandbox v9 SIFS Intel Manager 1.0 View shared with {'everyone': True, 'org': True, 'groups': [<Group title:"SARCOP Sandbox v9 - 38f775" owner:afackler_napsg>]}
Something is wrong with Waypoint Triage Status View. Exception thrown: You do not have permissions to access this resource or perform this operation.
(Error Code: 403)
Something is wrong with Waypoint Search Type. Exception thrown: You do not have permissions to access this resource or perform this operation.
(Error Code: 403)
UAS Recon Photos Sandbox shared with {'everyone': True, 'org': True, 'groups': []}