Attachment Attachment Attachment Class

Definition

Represents a document attachment in the Azure Cosmos DB service.

public class Attachment : Microsoft.Azure.Documents.Resource, System.Dynamic.IDynamicMetaObjectProvider
type Attachment = class
    inherit Resource
    interface IDynamicMetaObjectProvider
Public Class Attachment
Inherits Resource
Implements IDynamicMetaObjectProvider
Inheritance
Implements

Remarks

Each document may contain zero or more attachments containing data of arbitrary formats like images, binary or large text blobs.

The Attachment class represents the Azure Cosmos DB resource used to store information about the attachment like its location and

MIME content type. The payload itself ("Media") is referenced through the MediaLink property. The Attachment class is a DynamicObject

and can contain any custom metadata to be persisted.

Attachments can be created as managed or unmanaged. If attachments are created as managed through Azure Cosmos DB, then it is assigned a system

generated mediaLink. Azure Cosmos DB then automatically performs garbage collection on the media when parent document is deleted.

You can reuse the mediaLink property to store an external location e.g., a file share or an Azure Blob Storage URI.

Azure Cosmos DB will not perform garbage collection on mediaLinks for external locations.

Constructors

Attachment() Attachment() Attachment()

Initializes a new instance of an Attachment class for the Azure Cosmos DB service.

Properties

AltLink AltLink AltLink

Gets the alt-link associated with the resource from the Azure Cosmos DB service.

(Inherited from Resource)
ContentType ContentType ContentType

Gets or sets the MIME content type of the attachment in the Azure Cosmos DB service.

ETag ETag ETag

Gets the entity tag associated with the resource from the Azure Cosmos DB service.

(Inherited from Resource)
Id Id Id

Gets or sets the Id of the resource in the Azure Cosmos DB service.

(Inherited from Resource)
MediaLink MediaLink MediaLink

Gets or sets the media link associated with the attachment content in the Azure Cosmos DB service.

ResourceId ResourceId ResourceId

Gets or sets the Resource Id associated with the resource in the Azure Cosmos DB service.

(Inherited from Resource)
SelfLink SelfLink SelfLink

Gets the self-link associated with the resource from the Azure Cosmos DB service.

(Inherited from Resource)
Timestamp Timestamp Timestamp

Gets the last modified timestamp associated with the resource from the Azure Cosmos DB service.

(Inherited from Resource)

Explicit Interface Implementations

IDynamicMetaObjectProvider.GetMetaObject(Expression) IDynamicMetaObjectProvider.GetMetaObject(Expression) IDynamicMetaObjectProvider.GetMetaObject(Expression)

Methods

GetPropertyValue<T>(String) GetPropertyValue<T>(String) GetPropertyValue<T>(String)

Gets property value associated with the specified property name from the Azure Cosmos DB service.

(Inherited from Resource)
LoadFrom(JsonReader) LoadFrom(JsonReader) LoadFrom(JsonReader)

Loads the object from the specified JSON reader in the Azure Cosmos DB service.

(Inherited from JsonSerializable)
LoadFrom(JsonReader, JsonSerializerSettings) LoadFrom(JsonReader, JsonSerializerSettings) LoadFrom(JsonReader, JsonSerializerSettings)

Loads the object from the specified JSON reader in the Azure Cosmos DB service.

(Inherited from JsonSerializable)
SaveTo(Stream, SerializationFormattingPolicy) SaveTo(Stream, SerializationFormattingPolicy) SaveTo(Stream, SerializationFormattingPolicy)

Saves the object to the specified stream in the Azure Cosmos DB service.

(Inherited from JsonSerializable)
SaveTo(Stream, SerializationFormattingPolicy, JsonSerializerSettings) SaveTo(Stream, SerializationFormattingPolicy, JsonSerializerSettings) SaveTo(Stream, SerializationFormattingPolicy, JsonSerializerSettings)

Saves the object to the specified stream in the Azure Cosmos DB service.

(Inherited from JsonSerializable)
SetPropertyValue(String, Object) SetPropertyValue(String, Object) SetPropertyValue(String, Object)

Sets property value associated with the specified property name in the Azure Cosmos DB service.

(Inherited from Resource)
ToByteArray() ToByteArray() ToByteArray()

Serialize to a byte array via SaveTo for the Azure Cosmos DB service.

(Inherited from Resource)
ToString() ToString() ToString()

Returns the string representation of the object in the Azure Cosmos DB service.

(Inherited from JsonSerializable)

Applies to