Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1380
  • Last Modified:

use .net visual basic to query ldap

How can i get this info from ldap using .net visual basic?

Query hostname: ldapapi.mydomain.com
Base ou: "ou=people,ou=mydomain"
Ldap filter: "unixid=<userid>"
Requested attribute: title
0
chadmanvb
Asked:
chadmanvb
  • 2
1 Solution
 
chadmanvbAuthor Commented:
Those all look similar to how I would query active directory.  In this case I'm not querying active directory, but it is another ldap directory.  Can I do the same thing?  Below is some code in vbs that gets the attribute I need.  I just need to so the same thing in .net

Function getTitleInfo (userid)
 objCommand.CommandText =  "SELECT TITLE FROM 'LDAP://ldapapi/ou=people,o=My Domain' WHERE unixid='" & userid & "'"
 Set objRecordSet = objCommand.Execute
 On Error Resume Next
 While Not objRecordSet.EOF
   For Each i in objRecordSet.fields
      For Each v in i.value
         MsgBox(v) 'here I get the title info I was looking for...how can I do this in .net?
      Next
   Next
   objRecordSet.MoveNext
 Wend
 objConnection.close
End Function
0
 
chadmanvbAuthor Commented:
Thanks!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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