To delete a directory entry, you must specify the entry DN.
The following example builds on the code that adds an entry. It adds Retrieve and Delete buttons. The Retrieve button lets you view a user's information in the form before you delete it.
</
cfif
>
tags, add the following code:
<cfelseif Form.action is "Retrieve"> <cfldap name="GetEntry" server=#myServer# action="query" attributes="cn,sn,mail,telephonenumber,uid" scope="subtree" filter="uid=#Trim(Form.UID)#" start="o=Airius.com"> <cfset fullNameValue = GetEntry.cn[1]> <cfset surnameValue = GetEntry.sn[1]> <cfset emailValue = GetEntry.mail[1]> <cfset phoneValue = GetEntry.telephonenumber[1]> <cfset uidValue = GetEntry.uid[1]> <cfelseif Form.action is "Delete"> <cfldap action="delete" dn="uid=#Trim(Form.UID)#, ou=People, o=Airius.com" server=#myServer# username=#myUserName# password=#myPassword#> <cfoutput><h3>Entry for User ID #Form.UID# has been deleted
</h3></cfoutput>
input
tag with Value=Add
at the bottom of the form)
, delete the </td>
end tag.
input
tag, add the following code:
  <input type="Submit" name="action" value="Retrieve" tabindex="7">   <input type="Submit" name="action" value="Delete" tabindex="8"></td>
The following table describes the code:
Code | Description |
---|---|
<cfelseif Form.action is "Retrieve"> <cfldap name="GetEntry" server=#myServer# action="query" attributes="cn,sn,mail, |
If the user clicks Retrieve, queries the directory and gets the information for the specified User ID. Sets the form field's This example uses the array index [1] to identify the first row of the GetEntry query object. Because the query always returns only one row, the index can be omitted. |
<cfelseif Form.action is "Delete"> <cfldap action="delete" dn="uid=#Trim(Form.UID)#, |
The user clicks delete, deletes the entry with the specified User ID and informs the user that the entry was deleted. |
  <input type="Submit" name="action" value="Retrieve" tabindex="7">   <input type="Submit" name="action" value="Delete" tabindex="8"></td> |
Displays submit buttons for the Retrieve and Delete actions. |