• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

Problem with AD LDAP Ranges

from vb, this ldap query works for getting all the records:

<LDAP://10.0.0.1>;(&(objectCategory=Group)(cn=Group1));distinguishedname,name,member;subtree ........
however, if I try to insert a range into this query the recordset comes back with nothing:

<LDAP://10.0.0.1>;(&(objectCategory=Group)(cn=Group1));distinguishedname,name,member;range=0-9;subtree  
'this does NOT work and there are a few hundred members

Why doesn't that 2nd query work above?  Am I missing something with the RecordSet?  Does anyone have some example vb code that they have used with ldap ranges that I could compare?

I have read a very similar question from Pber posted here:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20896212.html?query=ldap+range+problem&clearTAFilter=true

and have looked at these links already:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/example_code_for_using_ranging_to_retrieve_members_of_a_group.asp

http://support.microsoft.com/default.aspx?scid=kb;en-us;814925

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ldap/ldap/searching_using_range_retrieval.asp
0
249Central
Asked:
249Central
1 Solution
 
dlwyatt82Commented:
Your code looks correct, at least the bit that you have posted so far.  When you say the "recordset comes back with nothing", I suspect you're not using the correct field name.

When you search for "member;range=0-9", that complete string is the field name you need to view in the Recordset.  Ex:

Set objCon = CreateObject("ADODB.Connection")
objCon.Open "Provider=ADsDSOObject;"
Set objCmd = CreateObject("ADODB.Command")
Set objCmd.ActiveConnection = objCon

objCmd.CommandText = "<LDAP://10.0.0.1>;(&(objectCategory=Group)(cn=Group1));distinguishedname,name,member;range=0-9;subtree"

Set objRS = objCmd.Execute

Do While (Not objRS.EOF)
  WScript.Echo objRS("distinguishedname")
  WScript.Echo objRS("name")
  WScript.Echo Join(objRS("member;range=0-9"), vbCrLf)
 
  objRS.MoveNext
Loop
0
 
249CentralAuthor Commented:
Thanks.  That was exactly what it was.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now