简体   繁体   中英

Changing Google Groups email from script throws Invalid Value

Being a super admin of my school's Google Workspace domain, I'd like to change Google Groups emails with a script. The following minimal script does his job changing the Name of the group:

function GroupUpd() {
  var OldEmail = '1z_22-23@abc.edu.it';
  var NewEmail = '2z_22-23@abc.edu.it';
  var NewName = "2Z";

  var group = AdminGroupsSettings.Groups.get(OldEmail);

  group.name=NewName;
  AdminGroupsSettings.Groups.patch(group, OldEmail);
}

Instead if I try to change the group email this code

function GroupUpd() {
  var OldEmail = '1z_22-23@abc.com';
  var NewEmail = '2z_22-23@abc.com';
  var NewName = "2Z";

  var group = AdminGroupsSettings.Groups.get(OldEmail);

  group.email=NewEmail;
  AdminGroupsSettings.Groups.patch(group, OldEmail);
}

gives:

GoogleJsonResponseException: API call to groupsSettings.groups.patch failed with error: Invalid Value

The very same happens if I use

AdminGroupsSettings.Groups.patch(group, OldEmail);

So, it seems to be a problem with NewEmail , but I have no idea what I am supposed to change.

DISCLAIMER: I'm a noob.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM