Updating an existing document

In addition to creating documents through OData, you can also update an existing not locked document with new data.

When updating documents, you must ensure that the mime type and the extension supplied in the slug matches the original.

The document must not be locked - meaning the document state must be UÅ or UP. If the document is in a locked state (ARK or UL), the update will throw an error and will fail.

The following example illustrates how to update an existing document using OData. CheckOut/In in the underlying system will be performed automatically.

Example:


string recordID = "112"; // The ID of the record you want to update the Document for.
 
// Get the existing Document.
Document document = context.Documents.Where(d => d.RecordID == recordID).Single();
 
// Update the blob.
context.SetSaveStream(document, new MemoryStream(Encoding.UTF8.GetBytes("The updated document contents.")), true, "text/plain", "document.txt");
context.SaveChanges();
				

The copy image is missing