node-activedirectory icon indicating copy to clipboard operation
node-activedirectory copied to clipboard

How to use paging

Open naran3434 opened this issue 6 years ago • 5 comments

Hi , Thanks for this great package. Can you show me how do i use paging after 1000 records.

naran3434 avatar May 30 '18 10:05 naran3434

I need this too. I have a fuzzy logic search so I have to pull in some basic info for all users in ldap and run levenshtein search against some values like first name and last name.

JasonCubic avatar Jun 14 '18 18:06 JasonCubic

Any update on this? I need this too

Tawsif avatar Nov 15 '18 06:11 Tawsif

Please add this feature.it will really helpful.if not we are just getting first 1000 results

stardev24 avatar Nov 16 '18 09:11 stardev24

Hi All, Since there is no response long time. I decided to use ldapjs, I was able to fetch all records without paging.

let values = [];
    let client = ldapjs.createClient(ldapOptions);

    client.on('connect', function (){

        client.bind(config.username, config.password, function(err) {

            client.search("OU=Company-Users,DC=Company,DC=com", opts, 
function(err, ldapresponse) {

                ldapresponse.on('searchEntry', function(entry) {
               // This is processed like event loop, 
              // you can write logic to capture as per your requirement
                        values.push(entry.object);
                });

                ldapresponse.on('page', function(entry, cb) {
                    //console.log("page event");
                    //if(cb) cb();
                });

                ldapresponse.on('end', function(result) {
                   // console.log('end event');
                    AsyncCallBack(values);
                });

                ldapresponse.on('error', function(resErr) {
                    console.log("error " + resErr);
                });
            });
        });

    });

Using above code i can able to fetch all the records of users, we have around 6000 records in LDAP. There is no performance issue.

Hope this will be help full.

naran3434 avatar Nov 26 '18 10:11 naran3434

Hi, any update on this? This package is working as required except paging is preventing me get all the results from AD. Can you please provide a way to override this?

piyush94 avatar Feb 05 '19 12:02 piyush94