Solved

Query LDAP using VB6

Posted on 2007-11-14
4
3,739 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
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…

752 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