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

UpdateAttachmentMetadata is used to update an attachment metadata in a database.


void UpdateAttachmentMetadata(string key, Etag etag, RavenJObject metadata);
key string key under which attachment is stored
etag Etag current attachment etag, used for concurrency checks (null to skip check)
metadata RavenJObject attachment metadata


JsonDocumentMetadata attachment = store.DatabaseCommands.Head("albums/holidays/sea.jpg");
RavenJObject metadata = attachment.Metadata;
metadata["Description"] = "Holidays 2012";

	.UpdateAttachmentMetadata("albums/holidays/sea.jpg", attachment.Etag, metadata);