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

Delete() public method

Asynchronously deletes the entry with the specified distinguished name from the directory and returns the results to the specified queue. Note: A Delete operation will not remove an entry that contains subordinate entries, nor will it dereference alias entries.
LdapException A general exception which includes an error /// message and an Ldap error code. /// ///
public Delete ( System dn, LdapResponseQueue queue ) : LdapResponseQueue
dn System The distinguished name of the entry to modify. /// ///
queue LdapResponseQueue The queue 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 Delete(System.String dn, LdapResponseQueue queue)
        {
            return Delete(dn, queue, defSearchCons);
        }

Same methods

LdapConnection::Delete ( System dn, LdapResponseQueue queue, LdapConstraints cons ) : LdapResponseQueue
LdapConnection::Delete ( System dn ) : void
LdapConnection::Delete ( System dn, LdapConstraints cons ) : void

Usage Example

Example #1
0
        static void Main(string[] args)
        {
            if ( args.Length != 5)
            {
            Console.WriteLine("Usage:   mono DelEntry <host name> <ldap port>  <login dn>" + " <password> <entry dn>");
            Console.WriteLine("Example: mono DelEntry Acme.com 389"  + " \"cn=admin,o=Acme\"" + " secret \"cn=cjhones,o=acme\"");
            return;
            }

            string ldapHost = args[0];
            int ldapPort = System.Convert.ToInt32(args[1]);
            String loginDN  = args[2];
            String password = args[3];
            String dn = args[4];

            try
            {
            Console.WriteLine("Connecting to:" + ldapHost);
            LdapConnection conn= new LdapConnection();
            conn.Connect(ldapHost,ldapPort);
            conn.Bind(loginDN,password);
            conn.Delete(dn);
            Console.WriteLine(" Entry: " +  dn + " Deleted Successfully");
            conn.Disconnect();
            }
            catch(LdapException e)
            {
            Console.WriteLine("Error:" + e.LdapErrorMessage);
            return;
            }
            catch(Exception e)
            {
            Console.WriteLine("Error:" + e.Message);
            return;
            }
        }
All Usage Examples Of Novell.Directory.Ldap.LdapConnection::Delete