Here is his current code and error:

_______________________________________________________

The error 0x80004005 Unspecified Error occurs when I try to query for
various items. I've added "otherphone" to this code as an example. The error
occurs on line 18: "objRS.Open strSQL, objConn, 1, 1".
 
----------------------------------------------------------------------------
----
 
strSearchString = "Firstname Lastname"
 
Dim objConn, strSQL, objRS, strConn 
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.Provider = "ADsDSOObject"
strConn = "Active Directory Provider"
objConn.Open strConn 
strSQL = "SELECT givenname, sn, telephonenumber, otherphone "
', mobile, facsimilyTelephoneNumber, pager 
strSQL = strSQL & "FROM 'LDAP://DOMAIN.COM' "
strSQL = strSQL & "WHERE objectClass = 'user' "
strSQL = strSQL & "AND (givenName = '*" & strSearchString & "*' OR sn = '*"
& strSearchString & "*' OR displayName = '*" & strSearchString & "*') "
strSQL = strSQL & "ORDER BY sn"
objRS.Open strSQL, objConn, 1, 1
 
While NOT objRS.EOF AND NOT objRS.BOF
 
 strFirstName = objRS("givenname").value
 strLastName = objRS("sn").value
 If objRS("telephonenumber").value = "" OR
IsNull(objRS("telephonenumber").value) Then
  strFullTelephoneNumber = ""
 Else
  strFullTelephoneNumber = objRS("telephonenumber").value
 End If
 If join(objRS("otherphone").value) = "" OR
IsNull(join(objRS("otherphone").value)) Then
  strExtension = ""
 Else
  strExtension = join(objRS("otherphone").value)
 End If
 
 Response.Write("<b>" & strFirstName & " " & strLastName & "</b><br>")
 Response.Write("Phone Number: <b>" & strFullTelephoneNumber & "</b><br>")
 Response.Write("<br>")
 objRS.MoveNext
Wend
 
objRS.close 
objConn.close
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to