Attachments: Get
There are few methods that allow you to download attachments from a database:
- GetAttachment
- GetAttachments
GetAttachment
GetAttachment can be used to download a single attachment.
Syntax
Attachment GetAttachment(string key);
Parameters | ||
---|---|---|
key | string | key of the attachment you want to download |
Return Value | |
---|---|
Attachment | Object 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 | ||
---|---|---|
start | int | Indicates how many attachments should be skipped |
startEtag | Etag | ETag from which to start |
batchSize | int | maximum number of attachments that will be downloaded |
Return Value | |
---|---|
AttachmentInformation | Object that represents attachment metadata information. |
Example
AttachmentInformation[] attachments = store
.DatabaseCommands
.GetAttachments(start: 0, startEtag: Etag.Empty, pageSize: 10);