Compartilhar via


ldap_add_s (Compact 2013)

3/26/2014

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

Syntax

ULONG ldap_add_s(
  LDAP* ld,
  UNICODE PTCHAR dn,
  LDAPMod* attrs[]
);

Parameters

  • ld
    [in] Session handle.
  • dn
    [in] Distinguished name of the entry to add.
  • attrs
    [in] Null-terminated array of pointers to LDAPMod structures. Each structure specifies a single attribute. See the Remarks section for more information.

Return Value

If this function succeeds, the return value is LDAP_SUCCESS.

If this function fails, it returns an error code. See the LDAP_RETCODE enumeration for a list of possible return values.

Remarks

Before calling this function, you must create an entry by specifying its attributes in LDAPMod structures. Set the mod_op member of 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_s returns to the caller. Use the ldap_add function if you prefer to have the operation carried out asynchronously.

In a multithreading environment, calls to ldap_add_s are thread-safe.

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 functions) before attempting any other operations.

Requirements

Header

winldap.h

Library

wldap32.lib

See Also

Reference

LDAP Directory Entry Functions
ldap_add
ldap_bind
ldap_simple_bind
LDAPMod