Solved

Query LDAP using VB6

Posted on 2007-11-14
4
3,728 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
null value 15 106
Latency in .net app using DB in .net 21 74
Runtime 3044 error 14 50
Backup databases and restore to another server -- how to alternate the chosen database? 7 41
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
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…

829 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