DocumentBase.Versions Property

Gets a Versions collection that represents all the versions of the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public Versions Versions { get; }

Property Value

Type: Microsoft.Office.Interop.Word.Versions
A Versions collection that represents all the versions of the document.

The following code example uses the Versions property to save a new version of the document and then displays information about all versions of the document. To use this example, run it from the ThisDocument class in a document-level project.


private void DocumentVersions()
{
    object comment = "My first save.";
    this.Versions.Save(ref comment);

    foreach (Word.Version version in this.Versions)
    {
        MessageBox.Show("Version " + version.Index.ToString() +
            " saved by " + version.SavedBy + " on " +
            version.Date);
    }
}


Community Additions

ADD
Show: