Skip To Content

esri_webfeaturelayer_deleteAttachment (AutoLISP)

The function deletes a file attachment from a feature of a web feature layer where the user's role supports editing or higher.

Syntax

(esri_webfeaturelayer_deleteAttachment flname ename attachmentName )

Arguments

  • flname | string | required | An existing web feature layer name in the drawing.
  • ename | entity name | required | The AutoCAD entity name of a feature to delete its attachment.
  • attachmentName | string | required | File name of attachment to delete.

Example usage 1

Prompts the user to select an entity from a web feature layer named Damage_to_Residential_Buildings and attempts to delete the attachment file named AutoCAD_drawingFiles.zip from the selected feature.

(setq ename (car (entsel)))
(esri_webfeaturelayer_deleteAttachment 
  "Damage_to_Residential_Buildings" 
  ename 
  "AutoCAD_drawingFiles.zip" 
)

Result example usage 1

The AutoCAD_drawings.zip file is deleted from the feature on the server and the function returns:

(T)

Example usage 2

Prompts the user to select an entity from a web feature layer named shelters and attempts to delete the attachment file named LandSurface.xml from the selected feature where the layer does not support attachments.

(setq ename (car (entsel)))
(esri_webfeaturelayer_deleteAttachment 
  "shelters" 
  ename
  "LandSurface.xml" 
)

Result example usage 2

The LandSurface.xml file is not deleted and the function returns:

 (nil ("Error" . "Layer does not support attachments"))

Return values

  • If successful, returns a list with the value of true: (T)
  • If failed, returns a list with the first value of nil and then an associated list containing the key value "Error" and an associated error message as a string: (nil ( "Error" . "<message>"))

A failed return value can occur for any of the following reasons:

  • (nil ("Error" . "Missing required argument."))

    One of the three required arguments is not supplied.

  • (nil ("Error" . "Web feature layer not found."))

    The web feature layer value specified is not a valid web feature layer in the drawing.

  • (nil ("Error" . "No connected web feature layers found."))

    The network connection to the web feature layer was lost.

  • (nil ("Error" . "'TargetAttachmentName' does not exist on the selected feature."))

    The specified attachmentName does not exist as an attachment on the specified feature.

  • (nil ("Error" . "No attachment found!"))

    There are no attachments found on the selected feature.

  • (nil ("Error" . "Layer does not support attachments"))

    The specified web feature layer does not support attachments.

  • (nil ("Error" . "User does not have privileges to perform this operation."))

    The organizational member account does not have the privileges to delete an attachment. This member account must support editing or higher.