Skip Navigation Links
Home
+
About
+
Products
+
Support
+
Purchase
+
Search
+
Rename (Method of LDAPEntry)
Change the Entry's relative distinguished name.
Syntax
Rename(NewRdn As String)
Remarks
Not available on LDAPv2 servers. The dn (distinguished name) of an entry is its unique identifier. A dn might be "uid=michalp,ou=Development,o=polonia-online.com". The relative dn is the base portion of this dn, namely "cn=michalp". The rest of the dn is called the parent dn, and it identifies the container in which this entry is stored. By renaming the relative dn of an entry, its location within the directory's hierarchy does not change (as it would if the Move Method were used). The new relative dn must be unique within this entry's container.<br> A side-effect of changing the rdn is that the attribute used to identify the rdn is modified. In the example below, the uid is used as the rdn, and by renaming it, the uid attribute gets modified as well.
Example
Set pLDAP = CreateObject("LDAPClient.3")
Call pLDAP.Connect("ldapserver")

' Brad Walker changed his first name to Dilbert 
Set pEntries = pLDAP.Search("o=airius.com", "(&(givenName=Brad)(sn=Walker))")

' Our schema uses the uid as the rdn.
' That is, Brad's dn starts with "uid=bwalker, o=...."
Set pEntry = pEntries(0)
Call pEntry.Rename("uid=dwalker")

' In addition to changing the dn, the uid attribute 
' will have changed as a result of this as well.
' Should now be dwalker instead of bwalker.
MsgBox pEntry.Attributes("uid").Values(0)