I am trying to get user email listing from my domain.
Ok. This is how I do it (code snippet):
UserService userService = new UserService("ProvisioningApiClient");
userService.setOAuth2Credentials(credential);
userService.useSsl();
UserFeed userFeed = userService.getFeed(url, UserFeed.class);
for (UserEntry userEntry : userFeed.getEntries()) {
logger.warning(userEntry.getEmail().toString());
}
The logger will throw NullPointerException error. But when I tried with userEntry.getTitle.getPlainText(), the name is shown.
Is there anything that I missed?
This is the solution I found:
Set a constant
private static final string DOMAIN = "mydomain.com";
Then get the user name from the userEntry and append string with alias and domain.
String userEmail = userEntry.getLogin.getUsername + "@" + DOMAIN;