Skip To Content

esri_webfeaturelayer_addAttachment (AutoLISP)

The function will attach a file to a feature of a web feature layer that supports attachments and where the user's role supports editing or higher. New features must be synchronized before adding attachments.

Syntax

(esri_webfeaturelayer_addAttachment flname ename filepath)

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 add attachment
  • filepath | string | required | Destination file path for the file to attach

Example usage 1

Prompts the user to select an entity from a web feature layer named "Damage_to_Residential_Buildings" and attempts to add the attachment file named "C:\\CADwork\\Attachments\\Olympus_Subdivision-2.0.xml"

(progn
(setq ename (car (entsel)))
(esri_webfeaturelayer_addAttachment 
  "Damage_to_Residential_Buildings" 
  ename 
  "C:\\CADwork\\Attachments\\Olympus_Subdivision-2.0.xml"
))

Result example usage 1

The "C:\\CADwork\\Attachments\\Olympus_Subdivision-2.0.xml" file is added to the selected 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 add the attachment file named "C:\\CADwork\\Attachments\\LandSurface.xml". However, the web feature layer does not support attachments.

(progn
(setq ename (car (entsel)))
(esri_webfeaturelayer_addAttachment 
  "shelters" 
  ename
  "C:\\CADwork\\Attachments\\Olympus_Subdivision-2.0.xml"
))

Result example usage 2

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

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

Return values

This function will return a value.

  • If successful, it returns a list containing the value of true: (T).
  • If failed, it 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>")).

Failed return values

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 specified web feature layer value 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" . "Layer does not support attachments"))

    The specified web feature layer does not support attachments.

  • (nil ("Error" . "File not found."))

    The specified file does not exist

  • (nil ("Error" . "No feature found."))

    The specified entity is not a valid feature of the specified web feature layer.