Question

In the old Provisioning API, we were able to rename user accounts. I don't see a pertinent parameter in the new Directory API documentation which would allow for renaming of a user account. Is this still possible?

https://developers.google.com/admin-sdk/directory/v1/reference/users/update

I have a feeling it may be as simple as updating the primaryEmail field to the new username but I'd like clarification.

Était-ce utile?

La solution

You guess it right. It is just as simple as changing the primaryEmail field. Here is my example below:

Let's say I am a reseller from reseller.com, and I have a resold domain called resold.com. Currently, I have one user created in my resold domain with the email address emily@resold.com. I am going to update it to happy@resold.com. Note: I am using my reseller reseller.com's credential.

PUT /admin/directory/v1/users/emily@resold.com

{
 "primaryEmail": "happy@resold.com"
}

HTTP/1.1 200 OK

{
 "kind": "admin#directory#user",
 "id": "XXXX",
 "primaryEmail": "happy@resold.com",
 "name": {
  "givenName": "Emily",
  "familyName": "Lam",
  "fullName": "Emily Lam"
 }
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top