on 10-11-2011 8:01 PM
Hello Experts,
Can anyone tell me how to fetch all the users belonging to a particular portal group. I managed to fetch all the groups assigned to a user by using following code
IUser uid = UMFactory.getUserFactory().getUserByLogonID(Userid);
Iterator groups = uid.getParentGroups(false);
while (groups.hasNext())
{
String str_grpname = (String)groups.next();
IGroup Group = UMFactory.getGroupFactory().getGroup(str_grpname);
if(Group.getUniqueName().startsWith("CPC"))
{
ary_groups.add(Group.getUniqueName());
}
}
But i am not able to fetch all users in a particular group. any help is appreciated.
Thanks,
Virag
Hi Virag,
Below is the code snippet to fetch all the users belonging to a portal group,
try {
IGroupFactory iGroupFactory = UMFactory.getGroupFactory();
IGroupSearchFilter groupFilter = iGroupFactory .getGroupSearchFilter();
groupFilter.setDisplayName("Group display name", ISearchAttribute.LIKE_OPERATOR, false);
ISearchResult result = iGroupFactory.searchGroups(groupFilter);
IGroup group = null;
while(result.hasNext()){
group = iGroupFactory.getGroup(result.next().toString());
}
if(group != null){
Iterator userSet = group.getUserMembers(true);
while(userSet.hasNext()){
String userId = userSet.next().toString();
IUser user = UMFactory.getUserFactory().getUser(userId);
}
}
}
catch (UMException umException) {
wdComponentAPI.getMessageManager().reportException("Exception Details: "+umException.toString());
}
Using IUser you can fetch user details.
Regards,
Vishweshwara P.K.M.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Virag,
Please see if the following code satisfies your requirement:
IGroup userGroup = UMFactory.getGroupFactory().getGroup("<Unique ID of Group>");
Iterator itGrpUsers = userGroup.getUserMembers(true);
You can refer to the following link on IGroup API for more details:
[http://help.sap.com/javadocs/NW04S/SPS09/se/com/sap/security/api/IGroup.html#getUserMembers(boolean)]
Regards,
Pavithra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I came across this [article|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b09cc7ef-8185-2b10-4aaa-96ffc93d237c] for searching the user availablitiy in a selected group.
Think this can help you to some extent..
In UME, you can perform a search based on User / Role / Group.
So, I think you can achieve this...
Regards,
Vijay.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.