ldap_add_ext function (winldap.h)

The ldap_add_ext function initiates an asynchronous add operation to a tree. The parent of the entry added must exist, or the parent must be empty (equal to the distinguished name of the root) for an add operation to succeed.

Syntax

WINLDAPAPI ULONG LDAPAPI ldap_add_ext(
  [in]  LDAP          *ld,
  [in]  const PSTR    dn,
  [in]  LDAPModA * [] attrs,
  [in]  PLDAPControlA *ServerControls,
  [in]  PLDAPControlA *ClientControls,
  [out] ULONG         *MessageNumber
);

Parameters

[in] ld

The session handle.

[in] dn

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

[in] attrs

An array of pointers to LDAPMod structures. Each structure specifies a single attribute. For more information, see the Remarks section.

[in] ServerControls

List of LDAP server controls.

[in] ClientControls

List of client controls.

[out] MessageNumber

The message ID for the request.

Return value

If the function succeeds, LDAP_SUCCESS is returned.

If the function fails, an error code is returned. For more information, see Error Handling.

Remarks

The parameters and effects of ldap_add_ext includes those of ldap_add. The extended routine includes additional parameters to support client and server controls and thread safety.

Before calling ldap_add_ext, create an entry by specifying its attributes in LDAPMod structures. Set the mod_op field of each structure to LDAP_MOD_ADD, and set the mod_type and mod_vals fields as appropriate for your entry.

If the operation succeeds, ldap_add_ext passes the message ID to the caller as a parameter. Call ldap_result with the message ID to get the result of the operation.

To have the results returned directly, use the synchronous function ldap_add_ext_s.

Multithreaded: Calls to ldap_add_ext are thread-safe.

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 other operations.
 
ServerControls and ClientControls are optional and should be set to NULL if not used.

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

Error Handling

Extended Controls

Functions

LDAPMod

Modifying a Directory Entry

Using Controls

ldap_add

ldap_add_ext_s

ldap_bind

ldap_result

ldap_simple_bind