ldap_deleteW function (winldap.h)

The ldap_delete function deletes an entry from the directory tree.

Syntax

WINLDAPAPI ULONG LDAPAPI ldap_deleteW(
  [in] LDAP        *ld,
  [in] const PWSTR dn
);

Parameters

[in] ld

The session handle.

[in] dn

A pointer to a null-terminated string that contains the distinguished name of the entry to delete.

Return value

If the function succeeds, it returns the message ID of the delete operation.

If the function fails, the return value is –1 and the function sets the session error parameters in the LDAP data structure. To retrieve this value, use LdapGetLastError.

Remarks

Call ldap_delete to remove a leaf entry from the directory tree. Be aware that LDAP does not support deletion of entire subtrees in a single operation. As an asynchronous function, ldap_delete returns a message ID for the operation. Call ldap_result with the message ID to get the result of the operation. To cancel an asynchronous delete operation before it has completed, call ldap_abandon.

To have the function return the results directly, use the synchronous routine ldap_delete_s. Use ldap_delete_ext or ldap_delete_ext_s to enable support for LDAP 3 server and client controls.

Multithreading: Calls to ldap_delete are thread-safe, provided that LdapGetLastError is used to retrieve the actual session error code when the function call returns the -1 failure code.

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.
 

Note

The winldap.h header defines ldap_delete as an alias which automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Target Platform Windows
Header winldap.h
Library Wldap32.lib
DLL Wldap32.dll

See also

Functions

LDAP

Modifying a Directory Entry

ldap_abandon

ldap_bind

ldap_delete_ext

ldap_delete_ext_s

ldap_delete_s

ldap_result

ldap_simple_bind