Understanding attachment sync results
Understanding attachment sync results
When yousynchronize attachments using a FeatureAttachmentSyncAgent, a summary of a synchronization results return as a FeatureAttachmentSyncResults object. This topic discusses how to obtain the FeatureAttachmentSyncResults, and you will learn about the properties. To learn about the attachment upload and download processes, read Uploading attachments and Synchronizing attachments.
//Cast the sync results to be FeatureAttachmentSyncResults.
FeatureAttachmentSyncResults results =
featureAttachmentSyncAgent.Synchronize() as FeatureAttachmentSyncResults;
You can also obtain a FeatureAttachmentSyncResults object as a property of FeatureSyncAgent, after the features download. Also recall, that you can set the FeatureSyncAgent.SynchronizeAttachments property to false so that it skips downloading attachments; in this situation, the FeatureSyncAgent is null.
//First prepare a FeatureSource and a MapDocumentConnection object.
//Then use them to create a FeatureSyncAgent object.
FeatureSyncAgent featureSyncAgent = new FeatureSyncAgent(featureSource, mapDocumentConnection);
//Using the default settings, you synchronize features with their attachments.
featureSyncAgent.Synchronize();
//Then you will obtain the FeatureAttachmentSyncResults. Note that a casting is not necessary.
FeatureAttachmentSyncResults results = featureSyncAgent.AttachmentSyncResults;
A FeatureAttachmentSyncResults object has the following properties:
- NonDownloadedAttachments:
A list of attachments that cannot be downloaded if an error occurs during the download process.
- NewAttachmentsUploaded:
A dictionary of attachments new to the cache and have been uploaded successfully.
- DeletedAttachmentsUploaded:
A list of attachments that have been deleted in the local storage and successfully deleted in the server-side database.
- UploadedAttachmentsErrors:
A dictionary of errors for uploaded attachments.