> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of Paul Jansen > Sent: Thursday, April 13, 2006 12:42 AM > To: [EMAIL PROTECTED] > Subject: net ldap, paging of large values from AD - problems > > Hello. > I'm having some trouble dealing with ranges or pages being > returned when I do a query. > I'm querying the homeMDBBL attribute which lists the > mailboxes in an Exchnage mail store. > When I view the entry using the Microsoft LDAP browser > (ldp.exe) it shows only a small amount of detail and says tha > tthe range returned is 0-1499. Apparently Windows 2003 AD has > a page size of 1500.
I was always under the impression that the maximum page size was 1000. drop your page size down to 200 and see what happens -- the page size is just how many records you return at a time -- smaller sets of data return quicker and leave less memory open handling the requests. Win32::Exchange has a properly formed (and paged search -- that could be used as a sample) if you want to go back to the OLE methods. I have no familiarity with the Net::LDAP functions, sorry. HTH However, if you are looking for homeMDBBL, your filter should really be: filter => "(homeMDBBL=*)", Since that will enumerate all the objects that have this property set. As well, since your filter is objectClass=*, you are enumerating objects that may or may not have this attribute set -- so, in a sense, your filter is too lax and actually including results that it need not look at. To find all the objects that have (both -- and only ones that have a class of Exchange Database) these attributes set you could use (&(objectClass=msExchMDB)(homeMDBBL=*)) <-- here's a hint However, I still only see 2 objects that have this prop set.. But then I am using E2K... And not E2K3 But lastly, if you look at this URL, I think I know what this property is used for now.. You have all the mailenabled paths in one property on the mailbox store (or public folder).. http://gsexdev.blogspot.com/2004_12_01_gsexdev_archive.html Never mind that the author has invalid code on the HTML part of this blog (probably a pasting error into the blog?)... It's the zip file of the code that you want to look at. Which explains what I wrote earlier.. homeMDBBL doesn't look to be a property on the mailboxes, but a property on the individual Exchange store objects (mailbox and public) that has a list of the mail-enabled recipients on each store. However, if you are still trying to look at all the mailboxes on a given store, there are much simpler ways of doing so (and if you want to look at multiple servers/stores there are even easier ways). Feel free to mail me offline for clarification as this is more of an Exchange question than a perl question. Again, I hope this helps. Steven > Anyway, I'm struggling to deal with this value properly. > Here is the code I have put together from looing at various > srouces but it doesn't work. It seems to fail to get a > cookie and drops out when doing the lookup. > If you have an exchnage environment it is a simple case of > altering the first four variables in the script below and > then running the script. You can browse with an LDAP browser > - such as ldp.exe -to determine what the values should be for > your environment. > Any suggestions? > > * * * * * > #!/usr/bin/perl -w > use Net::LDAP; > use Net::LDAP::Control::Paged; > use Net::LDAP::Constant qw( LDAP_CONTROL_PAGED ); > > $dc1 = "server01.mydomain.local"; > $user="cn=testuser,cn=Users,dc=mydomain,dc=local"; > $passwd="password"; > $ldap_query_string = "CN=SG1MDB2 > (SERVER12),CN=SG1,CN=InformationStore,CN=SERVER12,CN=Servers,C > N=SITE006,CN=Administrative > Groups,CN=MAILORG,CN=Microsoft > Exchange,CN=Services,CN=Configuration,DC=mydomain,DC=local"; > > $ldap = Net::LDAP->new($dc1); > > $mesg = $ldap->bind ( dn => $user, > password =>$passwd, > version => '3', > ); > if ( $mesg->code()) { > die ("error:", $mesg->code(),"\n","error name: > ",$mesg->error_name(), > "\n", "error text: > ",$mesg->error_text(),"\n"); > } > > my @mailbox_return_array = > get_specific_value_via_ldap("homeMDBBL", > $ldap_query_string); > foreach my $mailbox (@mailbox_return_array) { > print " mailbox is $mailbox -\n"; > } > > $ldap->unbind(); > > > sub get_specific_value_via_ldap { > my ($object_name, $ldap_query_string) = @_; > my @ldap_object_value; > > my $page = Net::LDAP::Control::Paged->new( size => 1490 ); > > @args = ( > base => $ldap_query_string, > scope => "sub", > filter => "(objectClass=*)", > control => [ $page ], > attrs => $object_name, > debug => 1 > ); > > my $cookie; > > while(1) { > print " performing search...\n"; > # Perform search > my $mesg = $ldap->search( @args ); > > # Only continue on LDAP_SUCCESS > if ($mesg->code) { > warn "ERROR - not LDAP_SUCCESS"; > last; > } > > # Get cookie from paged control > my($resp) = $mesg->control( > LDAP_CONTROL_PAGED ) or last; > $cookie = $resp->cookie or last; > print "cookie is $cookie -\n"; > # Set cookie in paged control > $page->cookie($cookie); > > foreach my $entry ($mesg->all_entries) { > @ldap_object_value = > $entry->get_value($object_name); > } > > } > if ($cookie) { > $page->cookie($cookie); > $page->size(0); > $ldap->search( @args ); > } > > return @ldap_object_value; > } > > * * * * > > If I replace the subroutine with this one below it still > doesn't work on a mail store that has more than 1500 entries > but if I run it on a mail store that has less I get all the > mail boxes back. > > * * * * > sub get_specific_value_via_ldap { > my ($object_name, $ldap_query_string) = @_; > my @ldap_object_value; > > my $page = Net::LDAP::Control::Paged->new( size => 1490 ); > > @args = ( > base => $ldap_query_string, > scope => "sub", > filter => "(objectClass=*)", > control => [ $page ], > attrs => $object_name, > debug => 1 > ); > > > my $mesg = $ldap->search( @args ); > > foreach my $entry ( $mesg->entries ) { > @ldap_object_value = > $entry->get_value($object_name); > # print " ldap_object_value is $ldap_object_value[0] > -\n"; > } > > return @ldap_object_value; > } > > * * * * > > Thanks, > PJ > > > > Send instant messages to your online friends > http://au.messenger.yahoo.com > _______________________________________________ > Perl-Win32-Admin mailing list > Perl-Win32-Admin@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > > _______________________________________________ Perl-Win32-Admin mailing list Perl-Win32-Admin@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs