I'm trying to update users of my domain to a new adress ,basically the same command than gam which is : " gam update user userx username mailadress@x.com "
My goal is to make the same thing but using google apps script, the documentation isn't very helpful because "AdminDirectory.Users.update(resource, userKey)" is even not present in it.
function updateUserName() {
var ss = SpreadsheetApp.getActive();
var sheet = ss.getActiveSheet();
var mailAdress= sheet.getRange(1, 1).getValue();
var user = AdminDirectory.Users.get(colAdresseMail);
user.emails = [address='newtest@mydomainname.com', primary=true];
Logger.log(user);
}
When I'm looking at logs, the address is now the new adress I want, but when I'm sending a mail to this adress, I have 2 mails , one with the mail I needed to have, and another mail delivery subsystem..
Maybe I forgot something?