Looks like he's setting the connection string to something
inappropriate:

<snip>
strConn = "Active Directory Provider"
objConn.Open strConn
</snip>

Should read more like:

<snip>
strConn = "LDAP://mydomain.com/DC=mydomain,DC=com";
objConn.Open strConn , strUserName , strPassword , 0
</snip>

Paul

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jason Benway
Sent: Thursday, June 10, 2004 12:59 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [ActiveDir] AD Phone list

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/





===========================================================

Important:
This electronic mail message and any attached files contain information
intended for the exclusive use of the individual or entity to whom it is
addressed and may contain information that is proprietary, privileged,
confidential and/or exempt from disclosure under applicable law.  If you
are not the intended recipient, you are hereby notified that any viewing,
copying, disclosure or distribution of this information may be subject to
legal restriction or sanction.  Please notify the sender, by electronic
mail or telephone, of any unintended recipients and delete the original
message without making any copies.

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