Need help with VBscript to pull email from AD

Author Message
Redtide001

  • Total Posts : 6
  • Scores: 0
  • Reward points : 0
  • Joined: 10/12/2010
  • Status: offline
Need help with VBscript to pull email from AD Monday, August 01, 2011 8:08 AM (permalink)
0
Hi All,

I have a form/app that users login to for trouble tickets. Below is the what the form/app uses to validate them.
code:
Private Function ValidateLogin( _
    ByVal Username As String, _
    ByVal Password As String, _
    ByVal Domain As String) As Boolean
 
        Dim token As IntPtr
 
        ' Call the API
        If LogonUser(Username, _
        Domain, _
        Password, _
        LOGON32_LOGON_NETWORK, _
        LOGON32_PROVIDER_DEFAULT, token) = True Then
 
            ' Since the API returned TRUE, return TRUE to the caller
            Return True
        Else
            ' Bad credentials, return FALSE
            Return False
        End If
    End Function
 
What I would like to do now is have it search AD for their email address and populate the fields in my form.
Code:
Populate Last, First (Manager_Text.text)
Populate email (director.text)

Any help out there??
 
I found this from dm4_ever which I think is close to what I need.  I just need it to pass it over to my form..
 
Option Explicit
 
 Dim objADSysInfo : Set objADSysInfo = CreateObject("ADSystemInfo")
 Dim objUser : Set objUser = GetObject("LDAP://" & objADSysInfo.UserName)
 WScript.Echo objUser.Mail
<message edited by Redtide001 on Monday, August 01, 2011 8:50 AM>
 
#1

    Online Bookmarks Sharing: Share/Bookmark

    Jump to:

    Current active users

    There are 0 members and 1 guests.

    Icon Legend and Permission

    • New Messages
    • No New Messages
    • Hot Topic w/ New Messages
    • Hot Topic w/o New Messages
    • Locked w/ New Messages
    • Locked w/o New Messages
    • Read Message
    • Post New Thread
    • Reply to message
    • Post New Poll
    • Submit Vote
    • Post reward post
    • Delete my own posts
    • Delete my own threads
    • Rate post

    2000-2012 ASPPlayground.NET Forum Version 3.9