lanter007
asked on
VB Filter AD: How find one Person in ActiveDirectory OU Tree?
I have a code which allways worked until I tried to query another firms ActiveDirectory.
I also tried with this search filter:
"(&(objectCategory=person) (objectCla ss=user)(s n=" & searchstring & "))"
and within LDAP://xx.xxxx.xxx/CN=User s,DC=xx,DC =xxxx,DC=x xx,OU=OU2 London"
I could find Computers and disabled Accounts. But I can not get to User Data in Organization Units.
The Tree is as follows:
xx.xxxx.xxx
OU1 Hong Kong (Organization Unit)
OU2 London (Organization Unit)
OU3 New York (Organization Unit)
Users (Organization Unit)
Groups (Organization Unit)
etc...
Any Ideas? I tried for hours......and it is soooo important.
Thanks in advance.
I also tried with this search filter:
"(&(objectCategory=person)
and within LDAP://xx.xxxx.xxx/CN=User
I could find Computers and disabled Accounts. But I can not get to User Data in Organization Units.
The Tree is as follows:
xx.xxxx.xxx
OU1 Hong Kong (Organization Unit)
OU2 London (Organization Unit)
OU3 New York (Organization Unit)
Users (Organization Unit)
Groups (Organization Unit)
etc...
Any Ideas? I tried for hours......and it is soooo important.
Thanks in advance.
Dim sPath As String = "LDAP://xx.xxxx.xxx/CN=Users,DC=xx,DC=xxxx,DC=xxx"
Dim adsRoot As New DirectoryServices.DirectoryEntry(sPath)
Dim mySearcher As DirectoryServices.DirectorySearcher = New DirectoryServices.DirectorySearcher(adsRoot)
Dim searchstring As String = Request("id")
Try
mySearcher.PropertiesToLoad.AddRange(New String() {"sAMAccountName,sn, description", "displayName, givenName"})
mySearcher.Filter = "(sAMAccountName=xxxxxxx)"
Dim myResult As DirectoryServices.SearchResult
myResult = mySearcher.FindOne
etc.....
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.