Error (0x80020009) Exception Occurred when using GetObject
Posted on 2003-11-05
I get this error, I believe, because there is no value being passed to the function.
Here is my code. I can call this function using VBScript easily when running a VBS but, when I insert into ASP and run from IIS server, I get the error. After some troubleshooting, it appears that my function isn't receiving the variable that I passed to it. I tested this by setting the sEMAIL within the function and it runs swimmingly. This function is defined at the top most portion of my ASP and I call it from further down once I've processed the form properties. All help is appreciated!!
' sEmail = "email@example.com"
dim SQLQuery, Conn, rs, objuser
SQLQuery = "SELECT name, distinguishedName FROM 'LDAP://DC=nac,DC=me,DC=com' WHERE objectCategory='Person' and objectClass='user' and mail='" & sEmail & "'"
Set Conn = CreateObject("ADODB.Connection")
Conn.Provider = "ADsDSOObject"
Conn.Open "Active Directory Provider"
Set rs = Conn.Execute(SQLQuery)
set objuser = Getobject("LDAP://" & rs("distinguishedName"))
CheckEmail = objuser.mail
Here is how I call the function:
strsemail = "firstname.lastname@example.org"
validEmail = ""
validEmail = CheckEmail(strsemail)
if validEmail = "" then
msgText = "ERROR! The Supervisor's Email cannot be validated"