Results 1 to 4 of 4

Thread: Quick Active Directory LDAP query variable issue

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    3

    Quick Active Directory LDAP query variable issue

    I have the following:

    LDAP://ou=X,dc=X,dc=X;(&(objectCategory=person)(objectClass=user)(sAMAccountName=strCuruser));sAMAccountNam e,altRecipient,mailNickname;subtree

    I need strCuruser to be a variable in (sAMAccountName=strCuruser).

    How should I enclose strCuruser to set it as a variable?

  2. #2
    New Member
    Join Date
    Mar 2005
    Posts
    10

    Re: Quick Active Directory LDAP query variable issue

    For any active directory functions I always refer to this posting on code project. Pretty much exposes anything you would want to do with LDAP.

  3. #3
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    Re: Quick Active Directory LDAP query variable issue

    VB Code:
    1. Dim ldap as String = String.Format("LDAP://ou=X,dc=X,dc=X;(&(objectCategory=person)(objectClass=user)(sAMAccountName={0}));sAMAccountName,altRecipient,ma ilNickname;subtree", TextBox1.Text)
    replace textbox1.text with however you retrieve the name you want.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2005
    Posts
    3

    Re: Quick Active Directory LDAP query variable issue

    Thanks,

    I figured this out earlier. This is what I did.

    strSam = "(sAMAccountName=" & strCuruser & "))"
    strFilter = "(&(objectCategory=person)(objectClass=user)" & (strSam)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width