ldap_add_ext_sW function (winldap.h)

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

Syntax

WINLDAPAPI ULONG LDAPAPI ldap_add_ext_sW(
  [in] LDAP          *ld,
  [in] const PWSTR   dn,
  [in] LDAPModW * [] attrs,
  [in] PLDAPControlW *ServerControls,
  [in] PLDAPControlW *ClientControls
);

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

A list of LDAP server controls.

[in] ClientControls

A list of client controls.

Return value

If the function succeeds, LDAP_SUCCESS is returned.

If the function fails, an error code is returned. For more information, see Return Values.

Remarks

The parameters and effects of ldap_add_ext_s include those of ldap_add_s. The extended routine includes additional parameters to support client and server controls.

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

Upon completion of the add operation, ldap_add_ext_s returns to the caller. Use ldap_add_ext if you prefer to have the operation completed asynchronously.

Multithreading: Calls to ldap_add_ext_s 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.

Note

The winldap.h header defines ldap_add_ext_s 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

Extended Controls

Functions

LDAPMod

Return Values

Using Controls

ldap_add_ext

ldap_add_s

ldap_bind

ldap_simple_bind