You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 5.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Attachments: Put

PutAttachment is used to insert or update an attachment in a database.


void PutAttachment(string key, Etag etag, Stream data, RavenJObject metadata);
key string unique key under which attachment will be stored
etag Etag current attachment etag, used for concurrency checks (null to skip check)
data Stream attachment data
metadata RavenJObject attachment metadata


using (var file = File.Open("sea.png", FileMode.Open))
		.PutAttachment("albums/holidays/sea.jpg", null, file, new RavenJObject
				                                           { "Description", "Holidays 2014" }