Skip to Content
author's profile photo Former Member
Former Member

Get user details from another user logged

Hi,

My business application is the following: I need, when the user is connected, to get the email adress of another user, whom I know the UserID.

The following source code sends me back a null pointer exception:

try {
	// Get the User unique ID
	IUserFactory userFact = UMFactory.getUserFactory();
	IUserSearchFilter userFilt = userFact.getUserSearchFilter();
	userFilt.setDisplayName("EDUJARDIN", ISearchAttribute.LIKE_OPERATOR, false);
	ISearchResult result = userFact.searchUsers(userFilt);
	if (result.getState() == ISearchResult.SEARCH_RESULT_OK) {
		while (result.hasNext()) {
			userUniqueId = (String) result.next();
			IUser thisUser = userFact.getUser(userUniqueId);
			mailADV = thisUser.getEmail();
			wdContext.currentUserInfoElement().setAdvEmail(mailADV);
		}
	}	
} catch (UMException e) {
	// TODO Auto-generated catch block
               msgMan.reportException("UMException " + e.getMessage(), false);
}

The instruction that generate a null pointer exception is:

wdContext.currentUserInfoElement().setAdvEmail(mailADV);

The userID is correct, and an email address has been filled in its details.

I do not understand why my code is not working, may somebody help me please ?

Thanks and regards.

Thibault

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jun 16, 2008 at 01:21 PM

    Hi Thibault schalck,

    better to use following code for getting the email adress of another use using employeeid (portal id)

    IUser wdUser = UMFactory.getUserFactory().getUserByLogonID(empno);

    String useremail = wdUser.getEmail();

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 16, 2008 at 01:25 PM

    Hi Thibault,

    Check the following code that will get email id, first name and last name from UME.

    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();

    }

    Hope that helps.

    regards

    Anil

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.