Directory Services


The ldap_get_dn function retrieves the distinguished name for a given entry.

PCHAR ldap_get_dn(
  LDAP* ld,
  LDAPMessage* entry


[in] The session handle.
[in] The entry whose distinguished name is to be retrieved.

Return Values

If the function succeeds, it returns the distinguished name as a pointer to a null-terminated character string.

If the function fails, it returns NULL and sets the session error parameters in the LDAP data structure.


The ldap_get_dn function retrieves the distinguished name for an entry that was returned by ldap_first_entry, or ldap_next_entry. When the returned name is no longer needed, free the string by calling ldap_memfree.


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, ldap_first_entry, ldap_memfree, ldap_next_entry