M
mwalk66
I have been able to create a web based company phone book by retrieving
the last name, first name, email address and telephone # from active
directory. However I need serious assistance in modifying the code to
sort the columns by order of last name then first name for ease of use
by our user community. Any assistance woudl be much appreciate since I
am a complete newbie to asp. I have quoted the cide for producing the
address book as follows:
<%@ LANGUAGE="VBSCRIPT" %>
<html>
<head>
<meta HTTP-EQUIV="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Company Address Book</title>
</head>
<body style="text-align: center">
<H1 align="center">Company Address Book</H1>
<TABLE BORDER="1" style="text-align: center">
<%
strDomainDN = " DC=mydomain, DC=com"
Set objCon = CreateObject("ADODB.Connection")
objCon.Provider = "ADsDSOObject;"
objCon.Open "Active Directory Provider"
Set objRS = objCon.Execute("<LDAP://" & strDomainDN & ">;" &
"(&(objectCategory=Person)(objectClass=user)(mail=*));" &
"sn,givenName,telephoneNumber,mail;subtree" )
objRS.MoveFirst
Response.write "<tr bgcolor=""#aaaaaa""><td ALIGN=Center><B>" & "Last
Name" & "</B></td>"
Response.write "<td ALIGN=Center><B>" & "First Name" & "</B></td>"
Response.write "<td ALIGN=Center><B>" & "Phone #" & "</B></td>"
response.write "<td ALIGN=Center><B>" & "E-mail Address" &
"</B></td></tr>"
While Not objRS.EOF
response.write "<td ALIGN=Left>" & objRS.Fields(0).Value & "</td>"
response.write "<td ALIGN=Left>" & objRS.Fields(1).Value & "</td>"
response.write "<td ALIGN=Left>" & objRS.Fields(2).Value & "</td>"
response.write "<td><A HREF=""mailto:" & objRS.Fields(3).Value &
""">"
response.write objRS.Fields(3).Value & "</A></td></tr>"
objRS.MoveNext
Wend
Set objRS = Nothing
Set objCon = Nothing
%>
</TABLE>
</body>
</html>
the last name, first name, email address and telephone # from active
directory. However I need serious assistance in modifying the code to
sort the columns by order of last name then first name for ease of use
by our user community. Any assistance woudl be much appreciate since I
am a complete newbie to asp. I have quoted the cide for producing the
address book as follows:
<%@ LANGUAGE="VBSCRIPT" %>
<html>
<head>
<meta HTTP-EQUIV="Content-Type" content="text/html;
charset=iso-8859-1">
<title>Company Address Book</title>
</head>
<body style="text-align: center">
<H1 align="center">Company Address Book</H1>
<TABLE BORDER="1" style="text-align: center">
<%
strDomainDN = " DC=mydomain, DC=com"
Set objCon = CreateObject("ADODB.Connection")
objCon.Provider = "ADsDSOObject;"
objCon.Open "Active Directory Provider"
Set objRS = objCon.Execute("<LDAP://" & strDomainDN & ">;" &
"(&(objectCategory=Person)(objectClass=user)(mail=*));" &
"sn,givenName,telephoneNumber,mail;subtree" )
objRS.MoveFirst
Response.write "<tr bgcolor=""#aaaaaa""><td ALIGN=Center><B>" & "Last
Name" & "</B></td>"
Response.write "<td ALIGN=Center><B>" & "First Name" & "</B></td>"
Response.write "<td ALIGN=Center><B>" & "Phone #" & "</B></td>"
response.write "<td ALIGN=Center><B>" & "E-mail Address" &
"</B></td></tr>"
While Not objRS.EOF
response.write "<td ALIGN=Left>" & objRS.Fields(0).Value & "</td>"
response.write "<td ALIGN=Left>" & objRS.Fields(1).Value & "</td>"
response.write "<td ALIGN=Left>" & objRS.Fields(2).Value & "</td>"
response.write "<td><A HREF=""mailto:" & objRS.Fields(3).Value &
""">"
response.write objRS.Fields(3).Value & "</A></td></tr>"
objRS.MoveNext
Wend
Set objRS = Nothing
Set objCon = Nothing
%>
</TABLE>
</body>
</html>