ldap_add
A version of this page is also available for
4/8/2010
This function initiates an asynchronous add operation to a tree. For an add operation to succeed, the parent of the entry being added must already exist or the parent must be empty (equal to the distinguished name of the root).
Syntax
ULONG ldap_add(
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.
Return Value
If this function succeeds, the return value is the message identifier of the add operation.
If this function fails, it returns –1 and sets the session error parameters in the LDAP data structure.
Remarks
Before calling this function, you must create an entry by specifying its attributes in LDAPModstructures. 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.
As an asynchronous function, this function returns a message identifier for the operation. Call the ldap_result function with the message identifier to get the result of the operation. To cancel an asynchronous add operation before it has been completed, call the ldap_abandonfunction.
If you prefer to have the results returned directly, use the synchronous function ldap_add_s. Use ldap_add_ext or ldap_add_ext_s if you need support for LDAP 3 server and client controls.
In a multithreading environment, calls to this function are not thread-safe because it returns a message identifier rather than the return code. To determine whether the call returned an error value, you have to retrieve the return code from the connection block. It is possible for another thread to overwrite the return code before you retrieve it. Use ldap_add_ext or ldap_add_ext_s, both of which are thread-safe.
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
Reference
ldap_abandon
ldap_add_ext
ldap_add_ext_s
ldap_add_s
ldap_bind
ldap_result
ldap_simple_bind
LDAP
LDAPMod