tags:

views:

323

answers:

1

I have been using the Java Netscape LDAP library to modify LDAP entries (http://www.mozilla.org/directory/javasdk.html). I now need a way to delete an entry. I looked through the library but could not find anything that I think would work.

Found “LDAPDelete” but that looks like it’s used from the command line.

If someone could post some sample code of how do this with an object ID it would very helpful.

ADDED: After searching and finding the object I used the return value from getDN() method as the DN string.

+1  A: 

Take a look at LDAPConnection.delete(java.lang.string dn) Thats what you should be using to delete an entry.

In pseudo code:

LDAPConnection myCon = new LDAPConnection("192.168.1.1",389);
myCon.delete("cn=Alan,ou=engineers,dc=fool,dc=com");

You'll have to javify that example, but that should work.

Netscape Directory API Documentation

Alan
I hadn't noticed that and was haivng trouble with the DN but got it working.Thanks!
Ben