- my $gms = [];
- my $GroupMembers = $group->MembersObj();
- while ( my $mo = $GroupMembers->Next() ) {
- if ( $mo->MemberObj->IsGroup ) {
- my $us = $mo->MemberObj->Object->UserMembersObj();
- my @users;
- while ( my $u = $us->Next() ) {
- push @users, $u->RealName . ' <' . $u->EmailAddress . '>';
+ unless ( $fields && !exists $fields->{members} ) {
+ my $gms = [];
+ my $GroupMembers = $group->MembersObj();
+ while ( my $mo = $GroupMembers->Next() ) {
+ if ( $mo->MemberObj->IsGroup ) {
+ my $us = $mo->MemberObj->Object->UserMembersObj();
+ my @users;
+ while ( my $u = $us->Next() ) {
+ push @users, $u->RealName . ' <' . $u->EmailAddress . '>';
+ }
+ push @$gms,
+ 'GROUP ['
+ . $mo->MemberObj->Object->Name . ']' . ' ('
+ . join( ';', @users ) . ')';
+ } elsif ( $mo->MemberObj->IsUser ) {
+ push @$gms,
+ $mo->MemberObj->Object->RealName . ' <'
+ . $mo->MemberObj->Object->EmailAddress . '>';