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

Modify() public method

Synchronously makes a single change to an existing entry in the directory, using the specified constraints. For example, this modify method changes the value of an attribute, adds a new attribute value, or removes 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, LdapConstraints cons ) : void
dn System The distinguished name of the entry to modify. /// ///
mod LdapModification A single change to be made to the entry. /// ///
cons LdapConstraints The constraints specific to the operation. /// ///
return void
        public virtual void Modify(System.String dn, LdapModification mod, LdapConstraints cons)
        {
            LdapModification[] mods = new LdapModification[1];
            mods[0] = mod;
            Modify(dn, mods, cons);
            return ;
        }

Same methods

LdapConnection::Modify ( System dn, LdapModification mod, LdapResponseQueue queue ) : LdapResponseQueue
LdapConnection::Modify ( System dn, LdapModification mod, LdapResponseQueue queue, LdapConstraints cons ) : LdapResponseQueue
LdapConnection::Modify ( System dn, LdapModification mod ) : 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