public void SetName( string attachmentName )
Public Sub SetName( _ ByVal attachmentName As String _ )
Parameters
- attachmentName
- The name of the attached document.
public void SetName( string attachmentName )
Public Sub SetName( _ ByVal attachmentName As String _ )
Exception | Description |
---|---|
ArcGIS.Core.Data.Exceptions.GeodatabaseException | A geodatabase-related exception has occurred. |
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run |
public async Task UpdatingAttachments() { await ArcGIS.Desktop.Framework.Threading.Tasks.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, Windows 10