Home > Mobile >  Changing Google Groups email from script throws Invalid Value
Changing Google Groups email from script throws Invalid Value

Time:09-15

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 = '[email protected]';
  var NewEmail = '[email protected]';
  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 = '[email protected]';
  var NewEmail = '[email protected]';
  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.

CodePudding user response:

Instead Groups Settings API use the Directory API.

References

  • Related