View Single Post
Old 06-19-2009   #3 (permalink)
Sander


 
 

Re: working LDAP query, well almost.. 800A000D

You are right!
How silly of me (I tried IsNull IsEmpty etc, but not IsArray

It works like a charm!

lots of Thanks!
Sander


"James Whitlow" <jwhitlow.60372693@xxxxxx> wrote in message
news:%23%23d1ydP8JHA.1376@xxxxxx
Quote:

> "Sander" <Sander@xxxxxx> wrote in message
> news:uqN2$YP8JHA.5424@xxxxxx
Quote:

>> Hello all,
>>
>> The following script should get 2 properties form the Administrator user:
>> "sAMAccountName" and "description".
>> It does display the sAMAccountName but throws an error when it tries to
>> display the user description.
>>
>> The code:
>> Set objRootDSE = GetObject("LDAP://RootDSE")
>> strDomainDN = objRootDSE.Get("DefaultNamingContext")
>> Set objConn = CreateObject("ADODB.Connection")
>> objConn.Provider = "ADsDSOObject"
>> objConn.Open "Active Directory Provider"
>>
>> Set objRSUserDescr = objConn.Execute("<LDAP://" & strDomainDN &
>> ">;(&(objectClass=user)(sAMAccountName=Administrator));sAMAccountName,description;subtree")
>>
>> WScript.echo objRSUserDescr.Fields(0).Value
>> WScript.echo objRSUserDescr.Fields(1).Value
>>
>>
>> The error:
>> this line: WScript.echo objRSUserDescr.Fields(1).Value
>> Error: Type Mismatch
>> Code: 800A000D
>
> I believe this property is an array. Change your line to:
>
> WScript.echo Join(objRSUserDescr.Fields(1).Value, vbCrLf)
>
>
>
>
My System SpecsSystem Spec