cancel
Showing results for 
Search instead for 
Did you mean: 

How to search the user based on e-mail id from webdynpro java

former_member192283
Participant
0 Kudos

Hi

I have one requirement for find the provided e-mail id is valid id or not. I need to build one custom webdynpro application. that application should accept the e-mail id and it should check against Portal UME whether that e-mail id exist or not if not i should indicate that id -not valid e-mail id.

Please let me know how implement this using UME API. Provide some sample code for it.

Thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

p330068
Active Contributor
0 Kudos
Former Member
0 Kudos

Hi

You can check this piece of code for checking email of the logged in user.

String strUserName = null;

String strUserLocation = null;

String strUserDepartment = null;

String UID = null;

try {

IWDClientUser wdClientUser = WDClientUser.getCurrentUser();

IUser sapUser = wdClientUser.getSAPUser();

if (sapUser != null) {

IUserAccount[] acct = sapUser.getUserAccounts();

if (acct[0] != null) {

strUserName = acct[0].getDisplayName();

// wdComponentAPI.getMessageManager().reportSuccess("userName"+strUserName);

UID = acct[0].getUniqueID();

IUser user = UMFactory.getUserFactory().getUserByLogonID(

strUserName);

user.getEmail();

// strUserLocation = user.getCountry().toString();

// strUserDepartment = user.getDepartment().toString();

// wdComponentAPI.getMessageManager().reportSuccess("userLocation"+strUserLocation);

// wdComponentAPI.getMessageManager().reportSuccess("userDepartment"+strUserDepartment);

// wdContext.currentExtraElement().setDepartment(

// strUserDepartment);

// wdContext.currentForProcessElement().setDepartment(strUserDepartment);

// wdContext.currentForProcessElement().setLocation(strUserLocation);

String uniquename = user.getUniqueName();

wdContext.currentExtraElement().setLastName(uniquename);

// wdContext.currentContextElement().getUmeRole(user.get);

// wdContext.currentExtraElement()

// .setLocation(strUserLocation);

}

}

} catch (WDUMException e) {

// wdComponentAPI.getMessageManager().reportSuccess("ex1"+e.getLocalizedMessage());

} catch (UMException e) {

// wdComponentAPI.getMessageManager().reportSuccess("ex2"+e.getLocalizedMessage());

}

Thanks and regards

Suresh

Former Member
0 Kudos

You can use the below code for searching:

		IUserFactory userFactory = UMFactory.getUserFactory();
		IUserSearchFilter userFilter;
		userFilter = userFactory.getUserSearchFilter();
		userFilter.setEmail(<email id>, ISearchAttribute.LIKE_OPERATOR/EQUAL_OPERATOR, false);
		ISearchResult userResult;
		userResult = userFactory.searchUsers(userFilter);

Regards,

Mahesh