Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
getUserByLoginId() returns null
System
I'm trying to use the following to retrieve a users email address but
getUserByLoginId()
always returns null.
//workspace is a reference to a workspace
//library is a reference to a library
try{
System.out.println("Workspace Name is: " + workspace.getName());
System.out.println("Library Name is: " + library.getName());
User user = library.getUserByLoginId("cbland"); //I've also tried User user = library.getUserByLoginId("domain.com","cbland"); Same results
System.out.println("User is: " + user);
System.out.println("User Email Address is: " + user.getEmail1());
} catch(Exception e) {
System.out.println("Exception caught: " + e);
}
OUTPUT
Workspace Name is: This is a workspace in FAC1
Library Name is: wsmp1
User is: null
Exception caught: java.lang.NullPointerException
The user is a member of the workspace, library , and has an email address. The users logon ID is cbland. Has anyone else tried to use this method ?
Find more posts tagged with
Comments
peter_choe
I think that you need to check that you have a SimpleSession object and that you are logged in. I don't see that code in your example:
SimpleSession session = SessionManger.getInstance().createSimpleSession();
session.logon("cbland", "password", "domain");
User user = session.getLoggedOnUser();
dbguy
As you are making the call from the Library, the logged on user must be a trustee manager of the trustee you want to find. Trustee managers are configured from Library Manager.
Migrateduser
Thanks for the quick responses.
DBguy was correct, I added my logged on user to the Trustee Managers and my code is working now.
Thanks again.
Chris