public Delete ( System dn, LdapResponseQueue queue, LdapConstraints cons ) : LdapResponseQueue | ||
dn | System | The distinguished name of the entry to delete. /// /// |
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. /// /// |
cons | LdapConstraints | The constraints specific to the operation. /// /// |
return | LdapResponseQueue |
public virtual LdapResponseQueue Delete(System.String dn, LdapResponseQueue queue, LdapConstraints cons)
{
if ((System.Object) dn == null)
{
// Invalid DN parameter
throw new System.ArgumentException(ExceptionMessages.DN_PARAM_ERROR);
}
if (cons == null)
cons = defSearchCons;
LdapMessage msg = new LdapDeleteRequest(dn, cons.getControls());
return SendRequestToServer(msg, cons.TimeLimit, queue, null);
}
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; } }