Closed dennisbrouwer91 closed 4 years ago
Possible duplicate of https://github.com/jsumners/node-activedirectory/issues/16
Following, because I don't currently have 2000 users but I need to know if there is a new bug before we use release 2.0.0 in production.
@dennisbrouwer91 Is this problem new in release 2.0.0 of this module? I notice in your code snippet that you have not used {paged:true} in the options parameter. That should help. I am actually surprised that you got more than 1000 results without the paged option, because 1000 is the default page size, but perhaps your AD administrator has specified a non-default page size. By the way I have never tried ad.find, I use ad.findUsers, I can only guess that the {paged:true} option works just the same in ad.find.
@jurjendijkstra : Thanks for your reply. Just to make sure. The "paged" option should be set in the config parameter right? Or do i need to set it on the ad.find ?
last time I checked it does nothing in the connection config parameter, it has to be used in the options parameter of ad.findUsers
(and probably ad.find too)
last time I tried was in issue #20 so that was a while ago
Thanks @jurjendijkstra. Do you have an example of that code that is working? Because i seem to be unable to drop in the config and the query?
hope this one line helps
ad.findUsers({baseDN: 'OU=testdepartment,DC=testcompany,DC=nl', paged: true}).then((adusers) => {
ad.findUsers({baseDN: 'dc=
TypeError: Cannot read property 'then' of undefined
That seems to not be working with 2.0.0? @jurjendijkstra
Yes I am testing with 2.0.0! The line I copied into the comment was actually:
return this.proxy.findUsers({baseDN: userDN.ou, paged: true}).then((adusers) => {
but you don't have my this.proxy so I replaced that by ad. Never mind. The intention is to show the options parameter
After making a promise around the retrieval of the users : It's working.
aSearchFilter = "objectClass=user";
var opts = {
filter: aSearchFilter,
attributes: ["cn", "sAMAccountName", "userPrincipalName", "dn"],
paged:true
}
function getAllUsers() {
return new Promise((resolve, reject) => {
ad.findUsers(opts, function(err, users) {
if (err) {
console.log('ERROR: ' +JSON.stringify(err));
return;
}
if ((! users) || (users.length == 0)) {
console.log('No users found.');
reject('No users found.')
return;
}
else {
resolve(users);
}
});
});
}
const AD = require('activedirectory2/lib/adpromise')
Hi,
I'm using this module to fetch around 27000 users from our AD. The module itself works, and i'm getting back around ~2000 users, but the other users are nowhere to be found in the resultset. Is this a bug in the pagination system in the module?
Code used :