Show / Hide Table of Contents

Class Attachment

A file (such as an image or document) attached to a feature in a ServiceFeatureTable or a GeodatabaseFeatureTable.

Inheritance
System.Object
Attachment
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Esri.ArcGISRuntime.Data
Assembly: Esri.ArcGISRuntime.dll
Syntax
public sealed class Attachment
Remarks

Attachments allow you to associate files containing additional information with specific, relevant features. For example, a building inspector could attach a PDF of a permit to a building feature. Attachments are not stored as attributes, rather the attachment data is linked with the feature inside its ServiceFeatureTable or a GeodatabaseFeatureTable.

If a feature table supports attachments (HasAttachments), each feature in the table may have zero or more attachments. Get a feature's collection of attachments by calling GetAttachmentsAsync(). You can examine an attachment's name, type, and file size, and download the file using GetDataAsync(). Once downloaded, you can work with the data in your app (display it to the user, for example).

If a feature allows editing of its attachments (CanEditAttachments value is true), you can add to the feature's collection of attachments using AddAttachmentAsync(String, String, Byte[]). The data must be in one of the supported attachment formats. You can also update or delete attachments from the ArcGISFeature, as required.

Your app's available memory and storage space may impact the size of attachments you can add to a feature, or retrieve from the feature's collection. Apps that need to work with large attachments should be tested using representative physical devices and sample attachments.

Properties

Name Description
ContentType

Gets the content type of the attachment.

HasFetchedData

Gets a value indicating whether the attachment data has been retrieved.

Id

Gets the id of the attachment.

Name

Gets the name of the attachment.

Size

Gets the size of the attachment's data in bytes.

Methods

Name Description
GetDataAsync()

Asynchronously retrieves attachment's data.

GetDataAsync(CancellationToken)

Asynchronously retrieves attachment's data.

Applies to

TargetVersions
.NET Standard 2.0100.3 - 200.7
.NET100.13 - 200.7
.NET Windows100.13 - 200.7
.NET Android200.0 - 200.7
.NET iOS200.0 - 200.7
.NET Framework100.0 - 200.7
Xamarin.Android100.0 - 100.15
Xamarin.iOS100.0 - 100.15
UWP100.0 - 200.7

Relevant samples

Edit feature attachments: Add, delete, and download attachments for features from a service.
In This Article
Back to top Copyright © 2022 Esri.