Each entry in the NDS tree is identified as a NWEntry object. The object returns the layout, field types, and other characteristics of an entry, and lets you modify the password and field values.
Gives the full name of the object.
object.FullName
String.
Read-write.
This example returns the full name of the context.
Set nwdir = CreateObject ("UCX:NWDIR")
’enter the username and password
nwdir.Login ("user","password")
’enter the full name of the entry to be
Set Entry = Nwdir.FindEntry("NDS:\\ACMEcorporation\Sales\TestUser") Print "The full name of the entry is: "&Entry.FullName
Print "The short name of the entry is: "&Entry.ShortName
Gives the short name of the object.
object.ShortName
String.
Read-only.
This example gives the short name of the current object.
Set nwdir = CreateObject ("UCX:NWDIR")
’enter the username and password
nwdir.Login ("user","Password")
’enter the full name of the entry to be
Set Entry = Nwdir.FindEntry("NDS:\\ACMEcorporation\Sales\TestUser") Print "The full name of the entry is: "&Entry.FullName
Print "The short name of the entry is: "&Entry.ShortName
Returns the Layout to which this object belongs.
object.Layout
NWLayoutDescription.
Read-only.
This example lists all the layouts and the details of each NDS layout.
Set nwdir = CreateObject ("UCX:NWDIR")
’Enter the user name and password
nwdir.Login ("user", "password")
’Enter the fullname of the entry
Set Entry =
nwdir.FindEntry("nds:\\ACMEcorporation\Sales\newyork")
Print "The full name of the entry is: "&Entry.FullName
Print "The short name of the entry is: "&Entry.ShortName
Print "The entry belongs to the layout"&Entry.Layout.Name
Gives the last modification date.
object.ModifyDate
Date.
Read-only.
This example prints the modification date for each entry in NDS.
Set dirObj = CreateObject("UCX:NWDIR")
’Enter the username and password
dirObj.Login ("user","password")
dirObj.FullName = "NDS:\\ACMEcorporation\Sales\Newyork"
Set Entry = dirObj.Entry
Print "This entry was last modified on: "&Entry.ModifyDate
Indicates whether the object is a partition root.
object.PartitionRoot
Boolean.
Read-only.
This example shows how to find whether a given entry is in the root partition.
Set dirObj = CreateObject("UCX:NWDIR")
’Enter the username and password
dirObj.Login("User","password")
dirObj.FullName="NDS\\ACMEcorp\Sales\Newyork"
Set Entry = dirObj.Entry
Print "The entry is a partition root" &Entry.PartitionRoot
Indicates whether the object is an alias.
object.Alias
Boolean.
Read-only.
This example indicates whether the entry is an alias.
Set dirObj = CreateObject("UCX:NWDIR")
’Enter the user name and password
dirObj.Login("user","password")
dirObj.FullName="NDS:\\ACMEcorp\Sales\newyork"
Set Entry = dirObj.Entry
Alias = Entry.Alias
If (Alias = TRUE) Then
Print "The Entry object is an Alias"
Else
Print "The Entry object is not an Alias"
Endif
Indicates whether the entry is a container object.
object.Container
Boolean.
Read-only.
This example indicates whether the entry is a Container object.
Set dirObj = CreateObject("UCX:NWDIR")
dirObj.Login("user", "password")
dirObj.FullName="NDS:\\ACMEcorp\Sales\Newyork"
Set Entry = dirObj.Entry
Container = Entry.Container
If (Container = TRUE) Then
Print "The Entry object is a Container"
Else
Print "The Entry object is not a Container"
Endif
Returns a collection of entry objects, if this entry object is a container object.
object.Entries
NWEntries.
Read-only.
This example lists the entries in NDS with its FullName, ShortName and the date it was last modified.
Set dirObj = CreateObject("UCX:NWDIR")
dirObj.Login("user", "password")
Set Entry = dirObj.Entries
Print "The number of entries: "&entry.Count
For each entry in dirobj.Entries
Print "The full name is " &Entry.FullName
Print "The short name is "&Entry.ShortName
Print "The entry was modified on "&Entry.ModifyDate
Next
Gets the partition root node of the object.
object.GetPartitionRoot()
None.
NWEntry.
This example gives the partition of the specified object.
Set nwdir=CreateObject ("UCX:NWDIR")
nwdir.Login ("user","password")
Set Entry=nwdir.FindEntry ("NDS:\\Acmecorp\Sales\Newyork")
’Get the partition root node in which this entry resides
Set partition = Entry.GetPartitionRoot()
Print "The short name of the partition: "&partition.shortname
Changes the password.
object.SetPassword(
NewPassword As String,
[OldPassword As String])
The new password of the entry.
The previous password of the entry.
Boolean.
This example shows how to change a password.
On Error Resume Next
Set nwdir=CreateObject ("UCX:NWDIR")
nwdir.Login ("user", "password")
Set Entry=nwdir.FindEntry ("nds:\\Acmecorp\Sales\manager")
’Set the object’s password
If (Entry.SetPassword ("newpassword", "oldpassword")) Then
Print "The password is changed sucessfully"
Else
Print "Unable to change the password"
Endif
Verifies the password.
object.VerifyPassword(
Password As String)
The password being passed in to be compared with the current password of the object.
Boolean.
Returns true if the password is correct; otherwise, returns false.
This example shows how to verify an object's password.
On Error Resume Next
Set nwdir=CreateObject ("UCX:NWDIR")
nwdir.Login ("user","password")
Set Entry=nwdir.FindEntry ("nds:\\Acmecorp\Sales\Manager")
’Set the object’s password
If (Entry.SetPassword ("new password","oldpassword")) Then
Print "The password is changed sucessfully"
Else
Print "Unable to change the password"
Endif
If (Entry.VerifyPassword ("new password")) Then
Print "Password Verification Success"
Else
Print "Password Verification Failed"
End If
Returns the value of the field.
object.GetFieldValue(
FieldName As String,
[ForceAsArray As Boolean])
Name of the field for which you want the value, for example: "Surname."
Default value is FALSE.
Variant.
If ForceAsArray is true, then the result will always be an array of values. For single-valued attributes, the result is an array of one value.
If there exists no value for the attribute, then this method sets an error and returns false.
For simple data types like boolean, the data integer is returned in the respective equivalent UCS form.
For complex types the return value is a UCS object; the property names of the object are same as the names of the structure members of the equivalent NDS syntax structure. For example: NWACL, NWEMailAddress, NWPostalAddress, NWTypedName, NWPath, NWNetAddress, NWOctetString. These are same as the equivalent ActiveX types.
For multi-valued attributes, the values are returned in an array.
This example gets the value of the Surname.
Set nwdir=CreateObject ("UCX:NWDIR")
nwdir.Login ("user", "password")
Set Entry=nwdir.FindEntry ("NDS:\\Acmecorp\Sales\Manager")
Surname=Entry.GetFieldValue ("Surname")
Print "Surname of " &Entry.Shortname &" is: "&Surname
Changes the value of the attribute.
object.SetFieldValue(
FieldName As String,
Value As Variant,
[PreviousValue As Variant])
Name of the desired field.
The field value to be set.
The previous value of the field.
Boolean.
For multi-valued attributes, each value and its previous value has to be passed in separate calls to setFieldValue. For example, to replace 5 member names of a group with 5 new names, setFieldvalue has to be called five times.
This example shows how to modify the value of an attribute; here the Surname.
Set nwdir=CreateObject ("UCX:NWDIR")
nwdir.Login ("User", "Password")
Set Entry=nwdir.FindEntry ("NDS:\\AcmeCorp\Sales\Newyork")
’Modify the Surname
Entry.SetFieldValue ("Surname","New Surname","Old Surname")
’Commit the changes
Entry.Update()
Changes the value of the attributes having NDS syntax stream.
object.LoadFieldValueFromFile(
FieldName As String,
FileName As String)
Name of the field to be set.
File name from which to retrieve value from and set field to.
Boolean.
If the Web-based script is not authenticated to eDirectory with appropriate rights, an error is returned.
This example shows how to update the changed attribute value to a file.
Set nwdir=createobject("UCX:NWDIR")
nwdir.Login ("admin", "password")
Set entry=nwdir.Findentry ("NDS:\\Acmecorp\Sales\TestUser")
If (entry.loadfieldvaluefromfile ("Login Script",
"sys:nsn\user\test.txt")) Then
Print "Loaded sucessfully"
Endif
If (entry.savefieldvaluetofile ("Login Script",
"sys:nsn\user\oldscript.txt")) Then
Print "Saved Sucessfully"
Endif
Reads the value of the attributes having NDS syntax stream and saves it to a file.
object.SaveFieldValueToFile(
FieldName As String,
FileName As String)
Name of the field value to read.
Name of file to write field value to.
Boolean.
If the Web-based script is not authenticated to eDirectory with appropriate rights, an error is returned.
This example shows how to save the attribute value to a file.
Set nwdir=createobject("UCX:NWDIR")
nwdir.Login ("admin", "password")
Set entry=nwdir.Findentry ("NDS:\\Acmecorp\Sales\TestUser")
If (entry.Loadfieldvaluefromfile ("Login Script",
"sys:nsn\user\test.txt")) Then
Print "Loaded sucessfully"
Endif
If (entry.savefieldvaluetofile ("Login Script",
"sys:nsn\user\oldscript.txt")) Then
Print "Saved Sucessfully"
Endif
Commits the changes to the entry object.
object.Update()
None.
Boolean.
This method is called after performing the changes to the attributes.
This example shows how to update changes made to an attribute value.
on Error Resume Next
Set nwdir=CreateObject ("UCX:NWDIR")
nwdir.Login ("Admin", "password")
Set Entry=nwdir.FindEntry ("NDS:\\Acmecorp\Sales\Newyork")
’Modify the Surname
If (Entry.SetFieldValue ("Surname", "Apps")) Then
’Commit the change
Entry.Update()
Print"Updated changes sucessfully"
Else
Print "Unable to update"
Endif