You can paginate the results using the MaxItems and Marker parameters.
MaxItems
Marker
public static void DeleteUsersAndGroupsInTestNameSpace(AmazonIdentityManagementServiceClient client) { ListGroupsResponse lgRes = client.ListGroups(new ListGroupsRequest() { PathPrefix = TEST_PATH }); foreach (Group g in lgRes.Groups) { GetGroupResponse ggRes = client.GetGroup(new GetGroupRequest() { GroupName = g.GroupName }); foreach (User u in ggRes.Users) { client.RemoveUserFromGroup(new RemoveUserFromGroupRequest() { GroupName = g.GroupName, UserName = u.UserName }); } client.DeleteGroup(new DeleteGroupRequest() { GroupName = g.GroupName }); } ListUsersResponse luRes = client.ListUsers(new ListUsersRequest() { PathPrefix = TEST_PATH }); foreach (User u in luRes.Users) { DeleteTestUsers(client, u.UserName); } }
public List<string> GetGroups(string aprofile) { List<string> ToReturn = new List<string>(); Amazon.Runtime.AWSCredentials credential; try { string accountid = GetAccountID(aprofile); credential = new Amazon.Runtime.StoredProfileAWSCredentials(aprofile); var iam = new AmazonIdentityManagementServiceClient(credential); ListGroupsRequest req = new ListGroupsRequest(); req.MaxItems = 100; var GROOPLIST = iam.ListGroups(req).Groups; foreach(var agroup in GROOPLIST) { ToReturn.Add(agroup.GroupName); } } catch(Exception ex) { } return ToReturn; }