Skip to main content

Attachments: Get

There are few methods that allow you to download attachments from a database:

GetAttachment

GetAttachment can be used to download a single attachment.

Syntax

Attachment GetAttachment(string key);
Parameters
keystringkey of the attachment you want to download
Return Value
AttachmentObject that represents attachment.

Example

Attachment attachment = store
.DatabaseCommands
.GetAttachment("albums/holidays/sea.jpg"); // null if does not exist

Stream data = attachment.Data();

GetAttachments

GetAttachments can be used to download attachment information for multiple attachments.

Syntax

AttachmentInformation[] GetAttachments(int start, Etag startEtag, int pageSize);
Parameters
startintIndicates how many attachments should be skipped
startEtagEtagETag from which to start
batchSizeintmaximum number of attachments that will be downloaded
Return Value
AttachmentInformationObject that represents attachment metadata information.

Example

AttachmentInformation[] attachments = store
.DatabaseCommands
.GetAttachments(start: 0, startEtag: Etag.Empty, pageSize: 10);