Skip To Content

FeatureAttachment.DeleteAsync (.NET)

The FeatureAttachment.DeleteAsync method deletes a file attachment from a feature in a web feature layer when the user's role supports editing or higher.

Declaration

public async Task<bool> Esri.ArcGISForAutoCAD.FeatureAttachment.DeleteAsync(Document doc, string flName, ObjectId objId, string attachmentName)

Parameters

TypeNameDescriptionRequired

Document

doc

The AutoCAD document to act on.

required

string

flName

An existing web feature layer name in the drawing that supports attachments.

required

ObjectId

objId

The AutoCAD ObjectId of the feature with the attachment that will be deleted.

required

string

attachmentName

The file name of the attachment that will be deleted.

required

Returns

TypeDescription

bool

true if the attachment was deleted successfully

Remarks on error conditions

This method may throw an exception or return false or null if a parameter is invalid or the web feature layer does not support attachments.

Example

Print the success of deleting the AutoCAD_drawingFiles.zip attachment file from the selected feature in the Damage_to_Residential_Buildings web feature layer.

// Initialize
var doc = Application.DocumentManager.MdiActiveDocument;
var flName = "Damage_to_Residential_Buildings";
var objId = Esri.ArcGISForAutoCAD.FeatureLayer.SelectEntity(doc, flName);
var attachmentName = "AutoCAD_drawingFiles.zip";

// Delete the attachment
var success = await Esri.ArcGISForAutoCAD.FeatureAttachment.DeleteAsync(doc, flName, objId, attachmentName);

// Print the success
doc.Editor.WriteMessage(success.ToString());

/* Example output
True
*/

See also

FeatureLayer.SelectEntity—A .NET method that prompts for the selection of one entity and returns its AutoCAD ObjectId.

WebFeatureLayer.SupportsAttachmentsAsync—A .NET method that specifies whether a web feature layer supports attachments by returning true if it does or false if it does not.

esri_webfeaturelayer_deleteAttachment—An AutoLISP function that deletes a file attachment from a feature of a web feature layer.