Solved

Query LDAP using VB6

Posted on 2007-11-14
4
3,699 Views
Last Modified: 2013-12-24
I was given the task to add LDAP functionality in a VB6 app but I have no LDAP experience. I am able to get some of what I'm looking for but not everything. Take a look at the namespace doc supplied to me at http://www.mikkeee.com/misc/namespace.gif.

-com
--corphome
---people
----people
----executives
----union
----international
---pseudo-accounts
----franchisees
----consultants
----vendors

Dim sConn As String
    sConn = "LDAP://parr.corphome.com:636/dc=com/dc=corphome/ou=people/cn=johndoe")
    Set LDAPinfo = GetObject(sConn)
    MsgBox  "Name:" & LDAPinfo.Get("Parrpayname")

The above allows me to get what I want when I'm looking into the people ou but the problem I'm facing is that I also need to search in the vendors ou which is under pseudo-accounts.

sConn = "LDAP://parr.corphome.com:636/dc=com/dc=corphome/ou=pseudo-accounts/ou=people/cn=johndoe")
This does not work.

Any suggestions would be helpful.

Thanks
0
Comment
Question by:Mikkeeee
4 Comments
 
LVL 23

Accepted Solution

by:
rama_krishna580 earned 250 total points
ID: 20284874
0
 
LVL 5

Expert Comment

by:23637269
ID: 20780124
I don't know if this will work or not but if MsgBox  LDAPinfo.Get("pseudo-accounts") returns the name of the account you want then.
Dim sPseudoAccount as string
sPseudoAccount = LDAPinfo.Get("pseudo-accounts")

sPseudoAccount should contain "CompanyABC"
You want to build the next string with the value of what sPseudoAccount contains.
That is where the @ comes in.  It tells the computer to use the value that the variable is holding, otherwise you would be using the name of the variable.

sConn = "LDAP://parr.corphome.com:636/dc=com/dc=corphome/ou=" & @sPseudoAccount  & "/ou=people/cn=johndoe")

Hope this helps or at least points you in the right direction, I haven't used LDAP before.

Thanks
Roger
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction: I have seen many questions on EE and elsewhere, asking about how to find either gaps in lists of numbers (id field, usually) ranges of values or dates overlapping date ranges combined date ranges I thought it would be a good …
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now