I have collected all users in a certain OU. Now i would like to change a parameter in the objects. But i get an error code TypeError: Cannot find function changePasswordAtNextLogin in object
function admsdk() {
var x = AdminDirectory.Users.list({
customer: "my_customer",
query: "orgUnitPath='/LegacyMail'",
});
Logger.log(x);
for(var i in x) {
x[i].changePasswordAtNextLogin(true);
}
}
The object have the parameter "changePasswordAtNextLogin
" but i get errors any way:
[14-02-21 12:13:41:182 CET] {users=[{etag="7XeU3X9xgwyeKXCCsYZGUBcBlgw/8gkNyn34hZeT3Dwd78gpIG0OyMEo", orgUnitPath=/LegacyMail, emails=[{address=abbec@mydomain.com, primary=true}, suspended=false, primaryEmail=abbec@mydomain.com, kind=admin#directory#user, id=1033d75074613787551986, isMailboxSetup=true, changePasswordAtNextLogin=false, customerId=wC030c3310,
Now it look's like this, but i can't get it to work:
function admsdk() {
var x = AdminDirectory.Users.list({
customer: "my_customer",
query: "orgUnitPath='/LegacyMail'",
});
Logger.log(x);
for(var i in x){
x[i].changePasswordAtNextLogin = true;
AdminDirectory.Users.update(changePasswordAtNextLogin, x);
}
}
It fail's on the AdminDirectory.Users.update(changePasswordAtNextLogin, x); am i thinking right resourceKey = the user variable, and the resource the property ?
AdminDirectory.Users.update(resource, userKey)