on 03-22-2007 3:49 PM
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
Should the users created in the portal be replicated to the SAP J2EE engine in order to see all the users in my webdynpro?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please, some help is need, award points waiting for you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.