java - Query to AD for unlimited results -
i using next code users in ad
hashtable<string, string> env = new hashtable<string, string>(); env.put(context.initial_context_factory, "com.sun.jndi.ldap.ldapctxfactory"); env.put(context.provider_url, "ldap://grupoasisa.local:636"); env.put(context.security_protocol, "ssl"); env.put(context.security_principal, "domasisa\\"+user_service); env.put(context.security_credentials, password_service); try { dircontext ctx = new initialldapcontext(env, null); searchcontrols searchctls = new searchcontrols(); string returnedatts[]={"samaccountname", "description", "mail"}; searchctls.setreturningattributes(returnedatts); //specify search scope searchctls.setsearchscope(searchcontrols.subtree_scope); searchctls.settimelimit(0); searchctls.setcountlimit(0); //specify ldap search filter string searchfilter="(&(objectcategory=person)(objectclass=user))"; //specify base search string searchbase = "dc=grupoasisa,dc=local"; // search objects using filter namingenumeration<searchresult> answer = ctx.search(searchbase, searchfilter, searchctls); //loop through search results while (answer.hasmoreelements()) { searchresult searchresult = answer.next(); attributes attrs = searchresult.getattributes(); attribute usuwin = attrs.get("samaccountname"); attribute racf = attrs.get("description"); attribute email = attrs.get("mail"); } } catch (namingexception e) { system.err.println("error: "+e.getmessage()); } catch (exception e) { system.err.println("error: "+e.getmessage()); }
and receiving 1000 first records although specifying search unlimited. happening?
thanks in advance.
not possible, have paginate (paginationcontrol) through results. try this answer.
Comments
Post a Comment