on 04-03-2007 4:28 AM
how can i retrieve the data based on the EmailAddress ?
Search criteria : EmailAddress (abuHassan@sap.com)
Retrieve Data :
UserId: Abu Hassan
Roles: Admin, Hr Manager, Logistic staff (several roles)
Group: Multitask_staff
pls tell me if there are "system/default table" that store the user data, so that i can retrieve the user information
below is the code to get the user data based on logon id:
IUser user=null;
IRole role=null;
try{
Iterator rit=null;
IWDClientUser clientUser=WDClientUser.getCurrentUser();
//IUser user=clientUser.getSAPUser();
user=clientUser.getSAPUser();
rit=user.getRoles(true);
String grp=new String();
String user_role=new String();
String info="";
IRoleFactory rfact=UMFactory.getRoleFactory();
System.err.println("user id" +user.getUniqueID());
IGroupFactory gfact=UMFactory.getGroupFactory();
IGroup group1=null,group2=null,group3=null;
group1=gfact.getGroupByUniqueName("EmailAdmin");
group2=gfact.getGroupByUniqueName("EmailNormalUser");
group3=gfact.getGroupByUniqueName("EmailSuperUser");
mgr.reportSuccess("User id:" +user.getUniqueID());
while(rit.hasNext()){
String roleName=(String) rit.next();
//IRole role=rfact.getRole(roleName);
role=rfact.getRole(roleName);
user_role=role.getDisplayName();
System.err.println("User role:" +user_role);
info=user.getDepartment() + user.getCellPhone() +user.getEmail();
System.err.println("User info: "+ info);
//check role
if(user_role.equalsIgnoreCase("role_EMAIL_ADMIN")){
role_EMAIL_ADMIN=true;
System.err.println("EMAIL_ADMIN is TRUE");
}else if(user_role.equalsIgnoreCase("role_EMAIL_NORMAL_USER")){
role_EMAIL_NORMAL_USER=true;
System.err.println("EMAIL_NORMAL_USER is TRUE");
}else if(user_role.equalsIgnoreCase("role_EMAIL_SUPER_USER")){
role_EMAIL_SUPER_USER=true;
System.err.println("EMAIL_SUPER_USER is TRUE");
}
}
}catch(WDUMException wd){
wd.printStackTrace();
}catch(UMException e){
e.printStackTrace();
}
Message was edited by:
yzme yzme
Message was edited by:
yzme yzme
Hi Yzme,
Try this:
IUserFactory uf = UMFactory.getUserFactory();
IUserSearchFilter ab = uf.getUserSearchFilter();
ab.setEmail("abuHassan@sap.com", ISearchAttribute.LIKE_OPERATOR, false);
ISearchResult result = uf.searchUsers(ab);
String uniqueid = result.next().toString();
IUser user = uf.getUser(uniqueid);
ITableDataSourceNodeElement a =
wdContext.createTableDataSourceNodeElement();
a.setCountry(user.getCountry());
a.setEMailAddress(user.getEmail());
a.setFirstName(user.getFirstName());
a.setLastName(user.getLastName());
<b>Do reward points if it helps</b>
Regards
Sid
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.