function configureOffice(Operation $op, $branch, $officename, $properties)
 {
     if (!array_key_exists('group-id', $properties)) {
         print "\nIn configureOffice: missing 'group-id' for {$branch} {$officename}\n";
         var_export($properties);
         print "\n";
     } else {
         $groupId = $properties['group-id'];
         $settingData = new \Google_Service_Groupssettings_Groups();
         // TODO: pull settings from properties
         // INVITED_CAN_JOIN or CAN_REQUEST_TO_JOIN, etc.
         $settingData->setWhoCanJoin("INVITED_CAN_JOIN");
         // ALL_MANAGERS_CAN_POST, ALL_IN_DOMAIN_CAN_POST,
         // ANYONE_CAN_POST, etc.
         $settingData->setWhoCanPostMessage("ANYONE_CAN_POST");
         // By default, we will archive emails in all groups except for the
         // aggregated groups, because it is assumed that these forward to
         // groups that are archived.
         $defaultIsArchived = $branch != '_aggregated';
         $settingData->setIsArchived(array_key_exists('archived', $properties) ? $properties['archived'] : $defaultIsArchived);
         $req = $this->groupSettingsService->groups->patch($groupId, $settingData);
         $this->batch->add($req, $op->nextSequenceNumber());
         if (isset($properties['alternate-addresses'])) {
             foreach ($properties['alternate-addresses'] as $alternate_address) {
                 $newalias = new \Google_Service_Directory_Alias(array('alias' => $alternate_address));
                 $req = $this->directoryService->groups_aliases->insert($groupId, $newalias);
                 $this->batch->add($req, $op->nextSequenceNumber());
             }
         }
     }
 }
  public $phones;
  public $primaryEmail;
  public $relations;
  public $suspended;
  public $suspensionReason;
  public $thumbnailPhotoUrl;
*/
// Get members of a group
$data = $service->members->listMembers($group_email);
var_export($data);
print "\n";
// List all the groups
$opt = array('domain' => "{$domain}");
$data = $service->groups->listGroups($opt);
var_export($data);
print "\n";
$service = new Google_Service_Groupssettings($client);
$settingData = new Google_Service_Groupssettings_Groups();
// Some API calls require that we request that the returned data be
// sent as JSON.  The PHP API for the Google Apps API only works with
// JSON, but some calls default to returning XML.
$opt_params = array('alt' => "json");
$data = $service->groups->get($group_email, $opt_params);
var_export($data);
print "\n";
// INVITED_CAN_JOIN or CAN_REQUEST_TO_JOIN, etc.
$settingData->setWhoCanJoin("CAN_REQUEST_TO_JOIN");
// ALL_MANAGERS_CAN_POST, ALL_IN_DOMAIN_CAN_POST, works
// ANYONE_CAN_POST returns 'permission denied'.
$settingData->setWhoCanPostMessage("ANYONE_CAN_POST");
$data = $service->groups->patch($group_email, $settingData);