cancel
Showing results for 
Search instead for 
Did you mean: 

API or code to get the list of users

Former Member
0 Kudos

Hi all,

Can some one give me pointers or some sample code to the API of web dynpro using which we can get all the list of users in the portal and also the list of users in a particular group??

This would be of great help for me.

Thank you.

Regards,

Narahari

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

There are so many posts regarding this query,

for the list of users u can go for this method

: getClientUsers();

which results in an array list.

go through these links which help u in coding..

but ur UME should be configured for this.

Regards,

Sirisha.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Narahari,

You can retrieve the users specific to a group by this code :

IGroup grp = UMFactory.getGroupFactory().getGroup(UniquegroupID);

Iterator users = grp.getUserMembers(true);

while(users.hasNext())

{

String unique_user = (String) users.next();

IUser user = UMFactory.getUserFactory().getUser(unique_user);

wdComponentAPI.getMessageManager().reportSuccess("User in group::"grp.getDisplayName()"::"+user.getDisplayName());

}

If you need to retrieve all the groups you can use :-

IGroupSearchFilter filter = UMFactory.getGroupFactory().getGroupSearchFilter();

ISearchResult result = UMFactory.getGroupFactory().searchGroups(filter);

while(result.hasNext())

{

IGroup grp = UMFactory.getGroupFactory().getGroup(result.next().toString());

wdComponentAPI.getMessageManager().reportSuccess("Group::"+grp.getDisplayName());

}

But before using all these, you need to add security.api.jar to your build path. For this In your NWDS, navigate to Your_project->properties->Java Build path->Libraries->Add variable->Click on Eclipse Home->extend->plugins->com.sap.security->lib->com.sap.security.api.jar.

Hope this helps,

Best Regards,

Nibu.

Message was edited by: Nibu Wilson

former_member1191927
Participant
0 Kudos

Hi Nibu,

I have used the code that you have given me in this case. It works perfectly when i build locally and deploy it directly onto the development system.

But i am getting syntax errors while doing a DC level build and while activating the DC before moving it to the next system.

I used the Add variable option that you have suggested. But it also doesn't work.

could you please tell me if there is any other way dealing with this problem.

Regards,

Narahari

former_member182372
Active Contributor
0 Kudos

Hello Narahari,

Check this

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi Narahari,

The following code will display all the users registered with the portal :

ISearchResult rst=UMFactory.getUserFactory().getUniqueIDs();

IUser iuser=null;

while(rst.hasNext())

{

iuser=UMFactory.getUserFactory().getUser(rst.next().toString());

wdComponentAPI.getMessageManager().reportSuccess("User::"+iuser.getDisplayName());

}

Hope this helps,

Best Regards,

Nibu.

Former Member
0 Kudos

Narahari,

Keywords: UME, UMFactory, IUserFactory

Search NW documentation (for API) and SDN for examples.

Valery Silaev

EPAM Systems

http://www.NetWeaverTeam.com/