Retrieving a specified version of a document

This section explains how to extract a previous version of a document. This may be useful in order to view a previous version and roll back to that previous version. You can then delete the subsequent versions that you no longer need.

Getting a document by its name shows how to retrieve a document when you know its name (i.e., its unique identifier).

Generating a list of document versions shows how to determine whether a document has more than one version, and how to retrieve a list of previous version numbers.

Once you know a document's name and the version number you wish to retrieve, you can retrieve the content, properties, and so forth by appending a semi-colon (;)and the version number to the name.

For example, to modify GetDocument.cs sample program so that it retrieves version 1 of the document (rather than the current version), make this change to one line:

// Original program retrieves the current version of one document:
documents[0] = documentName;
// Modified program retrieves Version 1 of the document:
documents[0] = documentName+";1";

Here are the properties retrieved from Version 1 of 20000703TS0000001440.XML, a document in SampleNewsDocbase. For this example, we created two additional versions of the document.

?<?xml version='1.0' encoding='UTF-16'?>