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
%>