Attachment Class

  • Attachment
  • class Esri::ArcGISRuntime::Attachment

    A feature attachment. More...

    Header: #include <Attachment.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Object

    Public Functions

    virtual ~Attachment() override
    qint64 attachmentId() const
    QUrl attachmentUrl() const
    QString contentType() const
    Esri::ArcGISRuntime::TaskWatcher fetchData()
    QFuture<QByteArray> fetchDataAsync()
    bool isDataFetched() const
    QString name() const
    qint64 size() const


    void fetchDataCompleted(const QUuid &taskId, const QByteArray &data)

    Detailed Description

    A feature attachment is an item associated with a feature but not an attribute of the feature. Where allowed, features may have zero or more attachments. Attachments can be images, documents, and so on. Information about an attachment includes name, size, and content type.

    Member Function Documentation

    [override virtual] Attachment::~Attachment()


    [since Esri::ArcGISRuntime 100.1] qint64 Attachment::attachmentId() const

    Returns the ID of the attachment.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    QUrl Attachment::attachmentUrl() const

    Returns the URL of the attachment if its data is already fetched.

    QString Attachment::contentType() const

    Returns the MIME type of the attachment file.

    Esri::ArcGISRuntime::TaskWatcher Attachment::fetchData()

    Fetches the raw data for the attachment and returns a TaskWatcher for the asynchronous operation.

    Only one fetch data operation can be executed at a time for the same attachment.

    [since Esri::ArcGISRuntime 200.2] QFuture<QByteArray> Attachment::fetchDataAsync()

    Returns the attachment's data.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    [signal] void Attachment::fetchDataCompleted(const QUuid &taskId, const QByteArray &data)

    Signal emitted when data has been fetched for this attachment.

    • taskId - The task ID for the asynchronous operation.
    • data - The data in bytes for the attachment.

    bool Attachment::isDataFetched() const

    Returns true if the attachment data has already been retrieved.

    This is true if the attachment data has been retrieved previously. Even so, you must call fetchData() to get the data. The operation should complete more quickly since the data is already available locally.

    You can request attachment data proactively to reduce the time it takes to retrieve the data from its source. However, to avoid unnecessary communication overhead, you should fetch the data only when the user needs it.

    QString Attachment::name() const

    Returns the name of the attachment.

    qint64 Attachment::size() const

    Returns the size of the attachment in bytes.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.