Is it possible to retrieve the set of maps a particular user has access to within their organization? I would like to have a user sign in to my app, then populate a list with all the maps they have access to within the organization.
Solved! Go to Solution.
I find it a little convoluted. But you need to get the Groups a user is in, and then from there all the PortalItems in those groups
private async Task<IEnumerable<PortalItem>> GetWebMaps(ArcGISPortal portal)
{
var groups = portal.User.Groups;
var usersMaps = new List<PortalItem>();
foreach (var portalGroup in groups)
{
var parameters = PortalQueryParameters.CreateForItemsOfTypeInGroup(PortalItemType.WebMap, portalGroup.GroupId);
parameters.Limit = 50;
var portalItems = (await portal.FindItemsAsync(parameters)).Results;
usersMaps.AddRange(portalItems);
}
return usersMaps;
}
I find it a little convoluted. But you need to get the Groups a user is in, and then from there all the PortalItems in those groups
private async Task<IEnumerable<PortalItem>> GetWebMaps(ArcGISPortal portal)
{
var groups = portal.User.Groups;
var usersMaps = new List<PortalItem>();
foreach (var portalGroup in groups)
{
var parameters = PortalQueryParameters.CreateForItemsOfTypeInGroup(PortalItemType.WebMap, portalGroup.GroupId);
parameters.Limit = 50;
var portalItems = (await portal.FindItemsAsync(parameters)).Results;
usersMaps.AddRange(portalItems);
}
return usersMaps;
}