how do I get email address from Active Directory

Author Message
des

  • Total Posts : 2
  • Scores: 0
  • Reward points : 0
  • Joined: 4/17/2008
  • Status: offline
how do I get email address from Active Directory Thursday, April 17, 2008 11:37 AM (permalink)
0
How can I get an email address from active directory? 
Anyway I could get the email address that is used in Outlook via traditional ASP would be appriciated. 
 
Is there a way to get it with ADSI from tradtional ASP?
 
I've tried a couple of LDAP scripts, but all return "Table does not exist.", so I'm not sure what I'm missing.
 
Here is an LDAP sample that I've tried, but it gives the table does not exist error.
I get the error at the ADOcom.execute line.
 
  <%@ Language=VBScript %>
 <%
 Response.Buffer=true
 strUser=Right(Request.ServerVariables("LOGON_USER"),8)
 Set ADOconn = CreateObject("ADODB.Connection")
 Set ADOcom = CreateObject("ADODB.Command")
 ADOconn.Provider = "ADsDSOObject"
 ADOconn.Open "ADs Provider", "xxx\id", "password"
 Set ADOcom.ActiveConnection = ADOconn
 ADOcom.Properties("Page Size") = 1000
 ADOcom.CommandText = "SELECT * from 'LDAP://xxx/dc=w1,dc=yyy,dc=net'  where SamAccountName='" & strUser & "'"
 Set Rec = ADOcom.Execute
 set fields = rec.fields(0)
 For Each objField in rec.Fields 'works fine
  ldap = objField
  response.write "result: " &objField &"<br>"
 Next
 %>
 
 

 
#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