HOW TO
There is no built-in functionality to get the list of groups that an item is shared with. In some cases where a portal is required to be re-federated, it can be tedious when the list of groups must be retrieved manually. The article provides an alternative way by using an ArcGIS API for Python script to retrieve the list for each item by specifying the itemID.
from arcgis.gis import GIS gis=GIS("https://www.arcgis.com","UserName","Password", verify_cert=False)
groups = gis.groups.search(query = "owner:UserName") Feature = 'd3a411e5beb7479e8c810671886094a1' groups group = []
d2=dict()
for g in groups: #print(g.title) item = g.content() l1=[] for thing in item: l1.append(thing.itemid) d2[g.title]=l1 search_results = []
for key, item in d2.items(): if Feature in item: search_results.append(key) print(search_results)
The following is a sample of the full script:
from arcgis.gis import GIS gis=GIS("https://www.arcgis.com","UserName","Password", verify_cert=False) groups = gis.groups.search(query = "owner:UserName") Feature = 'd3a411e5beb7479e8c810671886094a1' groups group = [] d2=dict() for g in groups: #print(g.title) item = g.content() l1=[] for thing in item: l1.append(thing.itemid) d2[g.title]=l1 search_results = [] for key, item in d2.items(): if Feature in item: search_results.append(key) print(search_results)
Get help from ArcGIS experts
Download the Esri Support App