Novell.Directory.Ldap.LdapConnection.Modify C# (CSharp) Method

Modify() public method

Asynchronously makes a single change to an existing entry in the directory. For example, this modify method can change the value of an attribute, add a new attribute value, or remove an existing attribute value. The LdapModification object specifies both the change to be made and the LdapAttribute value to be changed. If the request fails with {@link LdapException.CONNECT_ERROR}, it is indeterminate whether or not the server made the modification.
LdapException A general exception which includes an error /// message and an Ldap error code. ///
public Modify ( System dn, LdapModification mod, LdapResponseQueue queue ) : LdapResponseQueue
dn System Distinguished name of the entry to modify. /// ///
mod LdapModification A single change to be made to the entry. /// ///
queue LdapResponseQueue Handler for messages returned from a server in /// response to this request. If it is null, a /// queue object is created internally. /// ///
return LdapResponseQueue
        public virtual LdapResponseQueue Modify(System.String dn, LdapModification mod, LdapResponseQueue queue)
        {
            return Modify(dn, mod, queue, defSearchCons);
        }

Same methods

LdapConnection::Modify ( System dn, LdapModification mod, LdapResponseQueue queue, LdapConstraints cons ) : LdapResponseQueue
LdapConnection::Modify ( System dn, LdapModification mod ) : void
LdapConnection::Modify ( System dn, LdapModification mod, LdapConstraints cons ) : void

Usage Example

Example #1
0
    public static void doCleanup(LdapConnection conn, System.String userdn, System.String groupdn)
    {
        // since we have modified the user's attributes and failed to
        // modify the group's attribute, we need to delete the modified
        // user's attribute values.

        // modifications for user
        LdapModification[] modUser = new LdapModification[2];

        // Delete the groupdn from the user's attributes
        LdapAttribute membership = new LdapAttribute("groupMembership", groupdn);
        modUser[0] = new LdapModification(LdapModification.DELETE, membership);
        LdapAttribute security = new LdapAttribute("securityEquals", groupdn);
        modUser[1] = new LdapModification(LdapModification.DELETE, security);

        try
        {
            // Modify the user's attributes
            conn.Modify(userdn, modUser);

            System.Console.Out.WriteLine("Deleted the modified user's attribute values.");
        }
        catch (LdapException e)
        {
            System.Console.Out.WriteLine("Could not delete modified user's attributes: " + e.LdapErrorMessage);
        }
        catch(Exception e)
        {
            Console.WriteLine("Error:" + e.Message);
            return;
        }

        return ;
    }
All Usage Examples Of Novell.Directory.Ldap.LdapConnection::Modify