2 Replies Latest reply: Jul 21, 2012 11:31 PM by EJP RSS

    Get all groups from an AD Server

      Hi everyone,

      I'm trying to get all groups from and AD server.

      Here's how I'm doing it:
      DirContext ctx = new InitialDirContext( (Hashtable<String,String>) env);
                Name n2 = new CompositeName().add(groupsContainer);
                NamingEnumeration<Binding> contentsEnum = ctx.listBindings(n2);
                int i = 1;
                while ( contentsEnum.hasMore() && (i++) < 1000 )
                     Binding binding = contentsEnum.next();
                return groups; 
      The problem is, I always get an error if I don't restrict the results number to below 1000.

      The error is the following *javax.naming.SizeLimitExceededException: [LDAP: error code 4 - Sizelimit Exceeded];*

      After googling, I found it it's due to a field in the AD Server, that restrict the result number.

      So there is no way that I can obtain all groups without changing that field?