Hi Randy,
The following C# code iterates all groups in your domain and removes each
member from them:
AppsService service = new AppsService(domain, username, password);
AppsExtendedFeed groups = service.Groups.RetrieveAllGroups();
for (int i = 0; i < groups.Entries.Count; i++) {
AppsExtendedEntry group = (AppsExtendedEntry)groups.Entries[i];
string groupId = group.getPropertyValueByName("groupId");
AppsExtendedFeed members = service.Groups.RetrieveAllMembers(groupId);
for (int j = 0; j < members.Entries.Count; j++) {
AppsExtendedEntry member = (AppsExtendedEntry)members.Entries[j];
string memberId = member.getPropertyValueByName("memberId");
service.Groups.RemoveMemberFromGroup(memberId, groupId);
}
}
Claudio
On Tue, Jul 26, 2011 at 9:16 AM, Randy Maltbie <[email protected]> wrote:
> I am by no means a proficient .net developer but I have managed to get
> groups and users to create using the .net API. I need help with one last
> area though. I need to periodically cycle through all of my groups and
> delete all members of all groups. That seems really simple but I have been
> chasing my tail and looking at the same code and pages over and over and
> nothing is clicking for me.
>
> I get the basic concept of how to retrieve a list of all users, but I am
> not sure how to iterate through them to issue the individual delete from
> group commands. Any help would be greatly appreciated (especially a code
> snippet).
>
> Loop Through Groups
> Retrieve All Users In Group
> For x = 0 to Number of Users in Group
> Delete this user from this group
> Next
> Move to Next Group
> End Loop
>
> Thanks!
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Apps Domain Information and Management APIs" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-apps-mgmt-apis/-/tEVrxvs1tlQJ.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-apps-mgmt-apis?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google Apps Domain Information and Management APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-apps-mgmt-apis?hl=en.