Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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 LDAPModstructures. Each structure specifies a single attribute. See the Remarkssection 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_RETCODEenumeration for a list of possible return values.

Remarks

Before calling this function, you must create an entry by specifying its attributes in LDAPModstructures. Set the mod_opmember of each structure to LDAP_MOD_ADD, and set the mod_typeand mod_valsmembers as appropriate for your entry. Upon completion of the add operation, ldap_add_sreturns to the caller. Use the ldap_addfunction if you prefer to have the operation carried out asynchronously.

In a multithreading environment, calls to ldap_add_sare thread-safe.

When connecting to an LDAP 2 server, the application must perform a bind operation (by calling one of the ldap_bindor ldap_simple_bindfunctions) before attempting any other operations.

Requirements

Header winldap.h
Library wldap32.lib
Windows Embedded CE Windows CE .NET 4.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also