Novell is now a part of Micro Focus

How can I get the Full name via...

Articles and Tips: qna

01 Dec 2002


Q.

How can I get the Full name via LDAP? We are using ADSI using Windows scripting host against an LDAP-enabled eDirectory tree. Some attributes (fullName, for example) return the following error if we try to read the values from the LDAP using ADSI.:

The Active Directory datatype cannot be converted to/from a native DS datatype.

This above error occurs on the following line.

lns_fullname = lns_cont.Get("fullName")

A.

Microsoft's ADSI libraries have an incompatibility with the eDirectory schema (to which they have been made aware by Novell). For standard schema entries, your "get" method will work okay. But for any schema definitions outside the standard set, you will have to tell ADSI what type it is, and read it with the GetInfoEx Array, etc.

For more information on this, please go to developer.novell.com/support and search on ADSI. For your script, do something like what's shown in the sample below:

set UserObj=GetObject( 	"LDAP://myserver/o=novell/cn=admin" )
	
UserObj.GetInfoEx Array("fullname"), 3
	
Set entry = UserObj.GetPropertyItem( 	"fullname", 3 ) 'ci string type
	
For Each v In entry.Values 'if
multi-valued attribute
	
Set propVal = v
	
descString = 	propVal.GetObjectProperty(3)
	'ci string type
	
wscript.stdout.writeline descString
	
Next

The types are enumerated at http://msdn.microsoft.com/library/en-us/netdir/adsi/adstypeenum.asp?frame=true

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates