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: How to get attachment metadata only?

There are few methods that allow you to download attachment metadata from a database:
- HeadAttachment
- GetAttachmentHeadersStartingWith


HeadAttachment can be used to download attachment metadata for a single attachment.


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


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


GetAttachmentHeadersStartingWith can be used to download attachment metadata for a multiple attachments.


IEnumerable<Attachment> GetAttachmentHeadersStartingWith(
	string idPrefix,
	int start,
	int pageSize);
idPrefix string prefix for which attachments should be returned
start int number of attachments that should be skipped
pageSize int maximum number of attachments that will be returned
Return Value
AttachmentInformation Object that represents attachment metadata information.


IEnumerable<Attachment> attachments = store
	.GetAttachmentHeadersStartingWith("albums/holidays/", 0, 10);


Data property in Attachment will return empty stream for the above methods.