dmcghinnis
Technical User
Below is my code for my asp page. I need some help trying to find a
way to add the othertelephone array to the table that gets displayed.
I am new to ASP and querying ADSI but I have been able to get
everything else to work in my table. I just don't know the correct way
to house the array and then call it up as the table is being created.
Any help would be greatly appreciated. Thanks
<HTML>
<BODY>
<CENTER><H2>Wheeling Departmental Directory</H2><CENTER>
</TABLE>
<%
'TO DO : Change the below name to your Exchange server name
'
' Note if you want to use NT Challenge Response authentication this
' will need to be the same machine as the ASP is running on
strServerName = "ou=Wheeling Users,dc=vi,dc=wheeling,dc=il,dc=us"
strUser = Request.ServerVariables("LOGON_USER") 'retrieve the user
if strUser = "" then
Response.Write "You are using Anonymous authentication you will
need to change it so the user can be identified"
Response.End
end if
set oConn = CreateObject("ADODB.Connection")
set oCommand = CreateObject("ADODB.Command")
set oRS = CreateObject("ADODB.Recordset")
oConn.Provider = "ADsDSOObject"
oConn.Open "Ads Provider"
set oCommand.ActiveConnection = oConn 'set the active connection
' Next we will build the LDAP query that will be used to retrieve the
contents of the GAL.
' We will specify which server we want to run the query against,
' a filter for what types of objects we are looking for, the
attributes we would like
' returned, and the type of search
' A filter of (objectClass=person) will return mailboxes, distribution
lists, and custom recipients
strQuery= "<LDAP://" & strServername &
">;(objectClass=person);name,telephoneNumber,mobile,title,department,mail,facsimileTelephoneNumber,pager,otherTelephone"
oCommand.CommandText = strQuery
oCommand.Properties("Sort On") = "name"
oCommand.Properties("Page Size") = 99 'a paged query is used to
avoid Exchange LDAP server limits
set oRS = oCommand.Execute 'Execute the query
' Now we will loop through the results of our query
' and build a table to display the Global Address List
%>
<TABLE BORDER=4>
<TR>
<TH>Name/Title</br>Department/Email<TH>Work/Fax Numbers<TH>Mobile
Numbers
<%
While not oRS.EOF
arrPhone = oRS.Fields("otherTelephone")
%>
<TR>
<TD><b><%=oRS.Fields("name")%></b></b></br><i><%=oRS.Fields("title")%></i></br><%=oRS.Fields("department")%></br>
<a
href="mailto:<%=oRS.Fields("mail")%>"><%=oRS.Fields("mail")%></a>
<TD>Work: <%=oRS.Fields("telephoneNumber")%></br>
Fax: <%=oRS.Fields("facsimileTelephoneNumber")%>
<TD>Mobile: <%=oRS.Fields("mobile")%></br>
Nextel: <%=oRS.Fields("pager")%></br>
<%
oRS.MoveNext
wend
%>
</TABLE>
</BODY>
</HTML>
way to add the othertelephone array to the table that gets displayed.
I am new to ASP and querying ADSI but I have been able to get
everything else to work in my table. I just don't know the correct way
to house the array and then call it up as the table is being created.
Any help would be greatly appreciated. Thanks
<HTML>
<BODY>
<CENTER><H2>Wheeling Departmental Directory</H2><CENTER>
</TABLE>
<%
'TO DO : Change the below name to your Exchange server name
'
' Note if you want to use NT Challenge Response authentication this
' will need to be the same machine as the ASP is running on
strServerName = "ou=Wheeling Users,dc=vi,dc=wheeling,dc=il,dc=us"
strUser = Request.ServerVariables("LOGON_USER") 'retrieve the user
if strUser = "" then
Response.Write "You are using Anonymous authentication you will
need to change it so the user can be identified"
Response.End
end if
set oConn = CreateObject("ADODB.Connection")
set oCommand = CreateObject("ADODB.Command")
set oRS = CreateObject("ADODB.Recordset")
oConn.Provider = "ADsDSOObject"
oConn.Open "Ads Provider"
set oCommand.ActiveConnection = oConn 'set the active connection
' Next we will build the LDAP query that will be used to retrieve the
contents of the GAL.
' We will specify which server we want to run the query against,
' a filter for what types of objects we are looking for, the
attributes we would like
' returned, and the type of search
' A filter of (objectClass=person) will return mailboxes, distribution
lists, and custom recipients
strQuery= "<LDAP://" & strServername &
">;(objectClass=person);name,telephoneNumber,mobile,title,department,mail,facsimileTelephoneNumber,pager,otherTelephone"
oCommand.CommandText = strQuery
oCommand.Properties("Sort On") = "name"
oCommand.Properties("Page Size") = 99 'a paged query is used to
avoid Exchange LDAP server limits
set oRS = oCommand.Execute 'Execute the query
' Now we will loop through the results of our query
' and build a table to display the Global Address List
%>
<TABLE BORDER=4>
<TR>
<TH>Name/Title</br>Department/Email<TH>Work/Fax Numbers<TH>Mobile
Numbers
<%
While not oRS.EOF
arrPhone = oRS.Fields("otherTelephone")
%>
<TR>
<TD><b><%=oRS.Fields("name")%></b></b></br><i><%=oRS.Fields("title")%></i></br><%=oRS.Fields("department")%></br>
<a
href="mailto:<%=oRS.Fields("mail")%>"><%=oRS.Fields("mail")%></a>
<TD>Work: <%=oRS.Fields("telephoneNumber")%></br>
Fax: <%=oRS.Fields("facsimileTelephoneNumber")%>
<TD>Mobile: <%=oRS.Fields("mobile")%></br>
Nextel: <%=oRS.Fields("pager")%></br>
<%
oRS.MoveNext
wend
%>
</TABLE>
</BODY>
</HTML>