DocumentBase.DocumentLibraryVersions Property


Gets a DocumentLibraryVersionscollection that represents the collection of versions of a shared document that has versioning enabled and that is stored in a document library on a server.

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

public DocumentLibraryVersions DocumentLibraryVersions { get; }

The following code example displays a message that shows the total number of document versions if versioning is enabled in the document. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentDocumentLibraryVersions()
    Office.DocumentLibraryVersions dlvVersions = this.DocumentLibraryVersions;
    string strVersionInfo;
    if (dlvVersions.IsVersioningEnabled == true)
        strVersionInfo = "This docment has " + dlvVersions.Count +
            " versions";
        strVersionInfo = "Versioning is not enabled for this document.";

    MessageBox.Show(strVersionInfo, "Version Information", MessageBoxButtons.OK);
Return to top