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 changes an existing entry.

Syntax

ULONG ldap_modify(
  LDAP* 
ld,
  UNICODE PTCHAR 
dn,
  LDAPMod* 
mods[]
);

Parameters

ld

[in] Session handle.

dn

[in] Name of the entry to modify.

mods

[in] Null-terminated array of modifications to make to the entry.

Return Value

If this function succeeds, it returns the message identifier of the modify operation.

If this function fails, it returns –1 and sets the session error parameters in the LDAP data structure.

Remarks

This function initiates an asynchronous operation to modify an existing entry. If values are being added to or replaced in the entry, the function creates the attribute, if necessary. If values are being deleted, and no values remain, the function removes the attribute. All modifications are performed in the order in which they are listed.

As an asynchronous function, this function returns a message identifier for the operation. Call ldap_resultwith the message identifier to get the result of the operation. To cancel an asynchronous operation before it has completed, call ldap_abandon.

If you prefer to have the function return the results directly, use the synchronous routine ldap_modify_s. Use ldap_modify_extor ldap_modify_ext_sif you need support for LDAP 3 servers and client controls.

In a multithreading environment, calls to ldap_modifyare not thread-safe because the function 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_modify_ext, ldap_modify_s, or ldap_modify_ext_s, all of which are 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_bindroutines 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