Re: ADSI and NDS help



Hi,

The object may have been found, but the sn attribute is optional. If it has
no value, ADO returns a Null value, even if the user with the email address
exists. You might want to retrieve the NT name of the user, which is the
sAMAccountName attribute (which is mandatory). I'm assuming the problem is
that sn has no value in the recordset, in which case appending a blank
string simply makes the value returned for sn "".

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net

"Brian Burns" <noone@xxxxxxxxxxx> wrote in message
news:ck7b12pp4ifpqaiseaf1cgbm5dgbuvj3ra@xxxxxxxxxx
Why does this return a Null value? When I run the same query through
LPD.EXE, I find the object without any problems.

Thanks,
Brian Burns

On Thu, 9 Mar 2006 13:14:00 -0600, "Richard Mueller"
<rlmueller-NOSPAM@xxxxxxxxxxxxxxxxxxxx> wrote:

Brian Burns wrote:

I have an environment with both Active Directory and eDirectory. I am
trying to locate a user object in eDirectory via LDAP using ADSI. The
query i the script below runs successfully in ldp.exe; however, when I
run the script below, I receive the error Type Mismatch with code
800A000D. eDirectory is LDAP v3 compliant, so I would think this would
work

Dim conn
Dim rs

Set conn = CreateObject("ADODB.Connection")
conn.Provider = "ADSDSOObject"
conn.Open "ADs Provider"

Set rs = conn.Execute("<LDAP://Server>;" & _
"(mail=xxxx@xxxxxx);sn;subtree")

While Not rs.EOF
wscript.echo rs.Fields(0).Value
rs.MoveNext
Wend

conn.Close

Has anyone worked with this type of scenario? Is there something I am
missing? I know I can use the ADSI NDS provider, but I prefer to use
LDAP.

Hi,

Sometimes you get a type mismatch error when ADO returns a null value (in
this case when the user has no value assigned to the sn attribute). One
way
to fix it is to append a blank string, so the Null value is converted to a
blank string. For example:

wscript.echo rs.Fields(0).Value & ""



.



Relevant Pages

  • Re: get ProxyAddresses from any user in AD
    ... I think I like the ADO ... > the displayName attribute exposed by the LDAP provider. ... > ' Constants for the NameTranslate object. ... you could retrieve this from the WshNetwork object. ...
    (microsoft.public.scripting.vbscript)
  • Re: msDS-KeyVersionNumber AD property
    ... It doesn't look like LDAP provides access to the msDS-KeyVersionNumber ... and pasted the code into my script but it still reports a blank value. ... 'Setup ADO ...
    (microsoft.public.scripting.vbscript)
  • LDP ADO Equivalence
    ... I'm getting started with LDAP and am thrashing around. ... and used LDP to run some searches. ... My Question is how do I get the equivalent to work from VBScript using ADO? ... ' This controls which records we want to return from LDAP ...
    (microsoft.public.data.ado)
  • Re: Pls Help..Type Mismatch - Active Directory MemberOf ADSI Attribute?
    ... for querying ADSI data outside of ADO. ... >You'll have to build a string by enumerating all of the arrays values. ... >> Dim objConn 'ADO Connection object ...
    (microsoft.public.scripting.vbscript)
  • Re: How to replace dCount
    ... The type mismatch may occur if you don't have ADO in the references. ... >>Vanderghast, Access MVP ...
    (microsoft.public.access.formscoding)