Skip To Content

FeatureAttachment.ListAsync (.NET)

The FeatureAttachment.ListAsync method returns the attached file names for a specified web feature entity as a collection of strings.

Declaration

public async Task<IEnumerable<string>> Esri.ArcGISForAutoCAD.FeatureAttachment.ListAsync(Document doc, string flName, ObjectId objId)

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 a feature with the attached file names.

required

Returns

TypeDescription

IEnumerable<string>

A collection of attached file names as strings, or an empty collection if there are no attachments.

Remarks on error conditions

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

Example

Print the attached file names for a selected entity 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);

// Get the attached file names
var attachmentNames = await Esri.ArcGISForAutoCAD.Esri.ArcGISForAutoCAD.FeatureAttachment.ListAsync(doc, flName, objId); 

// Print the attached file names
foreach (var attachmentName in attachmentNames)
{
  doc.Editor.WriteMessage("\n" + attachmentName);
}

/* Example output
AutoCAD_drawingFiles.zip
Subdivision.xml
PowerPole.jpg
*/

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_listAttachments—An AutoLISP function that returns a list of attached file names as strings from a specified web feature entity.