FeatureAttachment.ListAsync 方法将以字符串集合的形式返回指定 web 要素实体的已附加文件名。
声明
public async Task<IEnumerable<string>> Esri.ArcGISForAutoCAD.FeatureAttachment.ListAsync(Document doc, string flName, ObjectId objId)
参数
| 类型 | 名称 | 描述 | 必填 |
|---|---|---|---|
文档 | doc | 要进行操作的 AutoCAD 文档。 | 必填 |
string | flName | 工程图中支持附件的现有 web 要素图层名称。 | 必填 |
ObjectId | objId | 具有已附加文件名的要素的 AutoCAD ObjectId。 | 必填 |
返回
| 类型 | 描述 |
|---|---|
IEnumerable<string> | 已附加文件名的字符串集合,如果没有任何附件,则为空集合。 |
错误条件备注
如果参数无效或者 web 要素图层不支持附件,则此方法可能会抛出异常或者返回 null。
示例
打印 Damage_to_Residential_Buildings web 要素图层中所选实体的已附加文件名。// 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
*/
另请参阅
FeatureLayer.SelectEntity - 此 .NET 方法将提示选择一个实体并返回其 AutoCAD ObjectId。
WebFeatureLayer.SupportsAttachmentsAsync - 此 .NET 方法通过返回 true(支持)或 false(不支持)来指定 web 要素图层是否支持附件。
esri_webfeaturelayer_listAttachments - 此 AutoLISP 函数将以字符串形式从指定 web 要素实体返回已附加文件名的列表。