The FeatureAttachment.DownloadAsync method downloads the specified attachment file from a specified feature of a supported web feature layer.
Declaration
public async Task<bool> Esri.ArcGISForAutoCAD.FeatureAttachment.DownloadAsync(Document doc, string flName, ObjectId objId, string attachmentName, string filePath, bool overwrite = false)
Parameters
| Type | Name | Description | Required |
|---|---|---|---|
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 that an attachment will be added to. | required |
string | attachmentName | The file name of the attachment to download. | required |
string | filePath | The destination file path for the downloaded file. | required |
bool | overwrite | Specifies whether an existing file will be overwritten at the specified file path. true will overwrite the file, false will not overwrite an existing file of the same name. | optional |
Returns
| Type | Description |
|---|---|
bool | true if the attachment was downloaded 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 downloading the AutoCAD_drawingFiles.zip attachment file from a selected feature on the Damage_to_Residential_Buildings web feature layer to a file named C:\CADwork\Attachments\Updated_Drawings.zip.// 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";
var downloadFilePath = @"C:\CADwork\Attachments\Updated_Drawings.zip";
// Download the attachment
var success = await Esri.ArcGISForAutoCAD.FeatureAttachment.DownloadAsync(doc, flName, objId, attachmentName, downloadFilePath);
// 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_downloadAttachment—An AutoLISP function that downloads the specified attachment file from a specified feature of a supported web feature layer.