How to get list of groups a portal user belongs to?

1797
2
Jump to solution
03-20-2018 02:57 PM
AndrewLindley
New Contributor III

I've run a query against portal to return a list of all users, but the user objects returned don't include the groups that each user belongs to. Any ideas how to get this info?

I've tried running a query against portal to return the groups, but can't get that to work. It always returns undefined... why doesn't normal syntax like 1=1 or '*' work when querying portal?

1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Andrew,

   Once you have the user class from the query you use the getGroups method

https://developers.arcgis.com/javascript/3/jsapi/portaluser-amd.html#getgroups 

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Andrew,

   Once you have the user class from the query you use the getGroups method

https://developers.arcgis.com/javascript/3/jsapi/portaluser-amd.html#getgroups 

AndrewLindley
New Contributor III

Thanks Robert!

Since I'm using the 4.x API, i ended up having to use the fetchGroups() method found here: PortalUser | API Reference | ArcGIS API for JavaScript 4.6, but same idea.