Public Sub UpdateAttachment( _ ByVal updatedAttachment As Attachment _ )
public void UpdateAttachment( Attachment updatedAttachment )
Parameters
- updatedAttachment
- An attachment for which all properties have been modified as desired.
Public Sub UpdateAttachment( _ ByVal updatedAttachment As Attachment _ )
public void UpdateAttachment( Attachment updatedAttachment )
| Exception | Description |
|---|---|
| ArcGIS.Core.Data.Exceptions.GeodatabaseAttachmentNotEnabledException | The table or feature class has not been enabled for attachment creation. |
| System.ArgumentNullException | updatedAttachment is null. |
| System.ArgumentException | updatedAttachment's attachment ID is invalid. |
| ArcGIS.Core.Data.Exceptions.GeodatabaseException | A geodatabase-related exception has occurred. |
{
await QueuedTask.Run(() =>
{
using (Geodatabase geodatabase = new Geodatabase(new DatabaseConnectionFile(new Uri("path\\to\\sde\\file\\sdefile.sde"))))
using (FeatureClass landUseCaseFeatureClass = geodatabase.OpenDataset<FeatureClass>("LocalGovernment.GDB.LandUseCase"))
{
QueryFilter filter = new QueryFilter { WhereClause = "CASETYPE = 'Rezoning'" };
using (RowCursor landUseCursor = landUseCaseFeatureClass.Search(filter, false))
{
while (landUseCursor.MoveNext())
{
using (Feature rezoningUseCase = (Feature)landUseCursor.Current)
{
IReadOnlyList<Attachment> rezoningAttachments = rezoningUseCase.GetAttachments();
IEnumerable<Attachment> filteredAttachments = rezoningAttachments.Where(attachment => !attachment.GetName().Contains("rezoning"));
foreach (Attachment attachmentToUpdate in filteredAttachments)
{
attachmentToUpdate.SetName(attachmentToUpdate.GetName().Replace(".pdf", "Rezoning.pdf"));
rezoningUseCase.UpdateAttachment(attachmentToUpdate);
}
}
}
}
}
});
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)