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

Delete() public method

Synchronously deletes the entry with the specified distinguished name from the directory, using the specified constraints. 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, LdapConstraints cons ) : void
dn System The distinguished name of the entry to delete. /// ///
cons LdapConstraints Constraints specific to the operation. /// ///
return void
        public virtual void Delete(System.String dn, LdapConstraints cons)
        {
            LdapResponseQueue queue = Delete(dn, null, cons);

            // Get a handle to the delete response
            LdapResponse deleteResponse = (LdapResponse) (queue.getResponse());

            // Set local copy of responseControls synchronously - if there were any
            lock (responseCtlSemaphore)
            {
                responseCtls = deleteResponse.Controls;
            }
            chkResultCode(queue, cons, deleteResponse);
            return ;
        }

Same methods

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