09-24-2009 08:59 AM
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
Solved! Go to Solution.
10-12-2009 11:20 AM
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
10-14-2009 09:41 AM
Thanks.
I had actually achieved this using the following lone line of code:
List<GroupInfo> groups = GroupInfo.GetGroupList("CONTACT");
10-14-2009 09:51 AM