You are currently browsing legacy 3.5 version of documentation. Click here to switch to the newest 5.1 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Attachments: Get

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


GetAttachment can be used to download a single attachment.


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


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

Stream data = attachment.Data();


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


AttachmentInformation[] GetAttachments(int start, Etag startEtag, int pageSize);
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.


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