Directory Services


The ldap_modrdn2_s function changes the relative distinguished name of an LDAP entry.

This function is obsolete. For LDAP 3 or later, use the ldap_rename_ext or ldap_rename_ext_s functions.

ULONG ldap_modrdn2_s(
  LDAP* ExternalHandle,
  PCHAR DistinguishedName,
  PCHAR NewDistinguishedName,
  INT DeleteOldRdn


[in] The session handle.
[in] A pointer to a null-terminated string that contains the distinguished name to change.
[in] A pointer to a null-terminated string that contains the new relative distinguished name to give the entry.
[in] TRUE if the old relative distinguished name should be deleted; FALSE if the old relative distinguished name should be retained.

Return Values

If the function succeeds, the return value is LDAP_SUCCESS.

If the function fails, it returns an error code. For more information, see Return Values.


Be aware that the various ldap_modrdn functions allow you to change only the relative distinguished name, which is the least significant component of the object's distinguished name. Effective with version 3, LDAP provides the Modify Distinguished Name protocol operation that allows access to name-change functions. This feature is available by calling ldap_rename_ext or ldap_rename_ext_s. These functions are recommended, rather than the ldap_modrdn2_s function, to change an entry name.

Note  When connecting to an LDAP 2 server, the application must perform a bind operation, by calling one of the ldap_bind or ldap_simple_bind routines, before attempting any other operations.


Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Unicode: Implemented as Unicode and ANSI versions on all platforms.
Header: Declared in Winldap.h.
Library: Use Wldap32.lib.

See Also

Functions, ldap_bind, ldap_modrdn2, ldap_rename_ext, ldap_rename_ext_s, ldap_simple_bind, Modifying a Directory Entry