Platform SDK: Active Directory, ADSI, and Directory Services

ldap_add_ext

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

ULONG ldap_add_ext(
  LDAP* ld,
  PCHAR dn,
  LDAPMod* attrs[] 
);
  PLDAPControlA* ServerControls,
  PLDAPControlA* ClientControls,
  ULONG* MessageNumber
);

Parameters

ld
[in] The session handle.
dn
[in] The distinguished name of the entry to add.
attrs
[in] An array of pointers to LDAPMod structures. Each structure specifies a single attribute. See Remarks for more information.
ServerControls
[in] List of LDAP server controls.
ClientControls
[in] List of client controls.
MessageNumber
[out] The message ID for the request.

Return Values

If the function succeeds, the return value is LDAP_SUCCESS.

If the function fails, it returns an error code. See Error Handling for more information.

Remarks

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

Before calling ldap_add_ext. you must 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.

If you prefer to have the the results returned directly, use the synchronous function ldap_add_ext_s.

Multi-thread: 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.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 SP4 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Winldap.h.
  Library: Use Wldap32.lib.
  Unicode: Declared as Unicode and ANSI prototypes.

See Also

Error Handling, Functions, ldap_add, ldap_add_ext_s, ldap_bind, LDAPMod, ldap_result, ldap_simple_bind, Modifying a Directory Entry