cancel
Showing results for 
Search instead for 
Did you mean: 

Get portal users list

Former Member
0 Kudos

Hello, good evening!

I want to compare if an email introduce in a field, matches with some of the emails from the portal users.

Does anyone know how to retrieve the users of the portal, not logged, I mean all of they. logged or not?

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jorge,

Use the following to get the All Portal Users:

try {

IUserFactory uf = UMFactory.getUserFactory();

ISearchResult result = uf.getUniqueIDs();

while (result.hasNext()) {

String uniqueid = result.next().toString();

IUser user = uf.getUser(uniqueid);

String userid = user.getUniqueName();

In the same way u can access all the remaining properties associated with user.

}

} catch(Exception e) {

-


}

Organise your imports and include the jar com.sap.security.api.jar from eclipse/plugins/com.sap.security/lib folder.

Regards,

Jhansi

Answers (7)

Answers (7)

Former Member
0 Kudos

I don't know how, but now I am retrieving values with the same code.

But my problem now is that I am fetching 30000 records and the application never stops.

Is there someway to get the value that I need in order to see all the records?

I mean I need to compare an email between the 30 000 records fetched,

Some help is needed please!!!

Former Member
0 Kudos

Hi,

You need to set up a filter on your search. Do something like this:

IUserSearchFilter isf = UMFactory.getUserSearchFilter;

isf.setEmail("EmailToFind",ISearchAttribute.EQUALS_OPERATOR,false);

ISearchResult sr = UMFactory.searchUsers(isf);

While (sr.hasnext()) {

}

Where "EmailToFind" is the email you want to check for.

if sr has no records it didn't find a matching email address...

Message was edited by:

Dana Boisvert

Former Member
0 Kudos

No, no I have the code adapted to my scenario. But only printing administrator information.

try {

IUserFactory usf = UMFactory.getUserFactory();

ISearchResult rst = usf.getUniqueIDs();

IUser iuser = null;

while (rst.hasNext()) {

String uniqueid = rst.next().toString();

iuser = usf.getUser(uniqueid);

String email = iuser.getEmail();

wdComponentAPI.getMessageManager().reportSuccess("Email: " + iuser.getEmail());

wdComponentAPI.getMessageManager().reportSuccess("Name: " + iuser.getUniqueName()); wdComponentAPI.getMessageManager().reportSuccess("UniqueID: " + iuser.getUniqueID());

}

} catch (Exception e) {

wdComponentAPI.getMessageManager().reportException(e.getMessage(),true);

}

Former Member
0 Kudos

Hello Jhansi Miryala ,

I am using a similar code to yours, by when executing this code is only retrieving the information of a user(administrator in this case), but there are many users created in the portal. Do you know what could be the reason?

Thanks in advance!

Former Member
0 Kudos

Jorge Cabeza,

Just addded little more code to what Jhansi has done please check it once.

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

IUserFactory usf = UMFactory.getUserFactory();

IUser iuser = null;

IUserListElement userElement = null;

int i = 0;

while (rst.hasNext()) {

iuser =

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

String email = iuser.getEmail();

String fname = iuser.getFirstName();

String lname = iuser.getLastName();

}

regards

Anil Dichpally

Former Member
0 Kudos

Should the users created in the portal be replicated to the SAP J2EE engine in order to see all the users in my webdynpro?

abhijeet_mukkawar
Active Contributor
0 Kudos

hi,

http://help.sap.com/saphelp_nw2004s/helpdata/en/69/3482ee0d70492fa63ffe519f5758f5/frameset.htm

in left task panes you will find searching users etc

hope it helps

regards,

abhijeet

Message was edited by:

abhijeet mukkawar

Former Member
0 Kudos

Hello I'm using this code,

try {

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

IUserFactory usf = UMFactory.getUserFactory();

boolean end = false;

IUser iuser = null;

while (rst.hasNext()) {

iuser =

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

String email = iuser.getEmail();

...

but it is only retrieving the Administrator name and properties, I think this code only retrieves the user that is currently logged, not all the portal users(logged or not)

Former Member
0 Kudos

Please, some help is need, award points waiting for you