Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Copper Elite Contributor
Posts: 70
Registered: ‎04-30-2009
Accepted Solution

SLX Web 7.5.1 - User's groups

Hi,

 

Is there some sort of API call I could use to get all contac groups for a user? Not only the groups they created, but all the groups they have access to?

 

Thanks

~ Henry

Employee
Posts: 9
Registered: ‎05-22-2009

Re: SLX Web 7.5.1 - User's groups

Yes, you can get the groups the current user has access to.

 

//Get the GroupContext instance for the current user:

 

GroupContext grpContext = GroupContext.GetGroupContext();

 

//Use it to get an "EntityGroupInfo" object for a particular entity (by Table name):

 

EntityGroupInfo egi = grpContext.GetGroupInfoForTable("CONTACT");

 

// (or, you could also iterate grpContext.EntityGroupInfos to find it yourself or get all of them for all entities.)

 

//The EntityGroupInfo object has a list of all the groups this user has access to for this entity.  

//Note:  this list contains the ones they have 'hidden'.

 

foreach(GroupInfo groupInfo in egi.GroupsList)

{

  //do something with groupInfo... groupInfo.GroupName, or groupInfo.GroupID etc.

}

 

 

Hope this is what you were asking for,

-Newell

 

Copper Elite Contributor
Posts: 70
Registered: ‎04-30-2009

Re: SLX Web 7.5.1 - User's groups

Thanks.

 

I had actually achieved this using the following lone line of code:

 

List<GroupInfo> groups = GroupInfo.GetGroupList("CONTACT");

 

 

Highlighted
Employee
Posts: 9
Registered: ‎05-22-2009

Re: SLX Web 7.5.1 - User's groups

Even better!