I want to create user account and user's Optional Properties (ex. addresses, emails, externalIds, ims, phones, organizations) using Directory API Users-insert. But when I check the insert result, only 4 property can be see (familyName, givenName, password, primaryEmail),but others field doesn't work, and the request is fine with status code 200.
And I try Users- Update or Patch to Optional Properties, and also the request is fine with status code 200, but i cannot see my changes in my user profile.
What do I need to do can create these Optional properties ?
My current scopes are:
private static final String[] tscopes = {
"https://www.googleapis.com/auth/admin.directory.user" ,
"https://www.googleapis.com/auth/admin.directory.orgunit",
};
Using Users-insert:
User user = new User();
UserOrganization uorg = new UserOrganization();
UserPhone uphone = new UserPhone();
UserName uname = new UserName();
uname.setFamilyName("A").setGivenName("BC");
uorg.setTitle("Engineer").setCostCenter("CA").setDepartment("IT");
uphone.setValue("00-2345678").setType("work");
user.setName(uname).setPassword("abcd").setPrimaryEmail("abc@mydomain.com").setOrganizations(uorg).setPhones(uphone);
Directory.Users.Insert dui = service.users().insert(user);
dui.execute();
getLastResponseHeaders:
{cache-control=[no-cache, no-store, max-age=0, must-revalidate], content-encoding=[gzip], content-type=[application/json; charset=UTF-8], date=[Wed, 05 Oct 2016 10:35:23 GMT], etag=["xxxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx"], expires=[Mon, 01 Jan 1990 00:00:00 GMT], transfer-encoding=[chunked], alt-svc=[quic=":443"; ma=2592000; v="36,35,34,33,32"], server=[GSE], x-content-type-options=[nosniff], pragma=[no-cache], x-frame-options=[SAMEORIGIN], vary=[X-Origin, Origin], x-xss-protection=[1; mode=block]}
getLastStatusCode: 200