共用方式為


DocumentBase.DocumentLibraryVersions Property

Definition

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.

public:
 property Microsoft::Office::Core::DocumentLibraryVersions ^ DocumentLibraryVersions { Microsoft::Office::Core::DocumentLibraryVersions ^ get(); };
public Microsoft.Office.Core.DocumentLibraryVersions DocumentLibraryVersions { get; }
member this.DocumentLibraryVersions : Microsoft.Office.Core.DocumentLibraryVersions
Public ReadOnly Property DocumentLibraryVersions As DocumentLibraryVersions

Property Value

A DocumentLibraryVersions collection.

Examples

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";
    }
    else
    {
        strVersionInfo = "Versioning is not enabled for this document.";
    }

    MessageBox.Show(strVersionInfo, "Version Information", MessageBoxButtons.OK);
}
Private Sub DocumentDocumentLibraryVersions()
    Dim dlvVersions As Office.DocumentLibraryVersions = Me.DocumentLibraryVersions
    Dim strVersionInfo As String
    If dlvVersions.IsVersioningEnabled = True Then
        strVersionInfo = "This docment has " & dlvVersions.Count & " versions"
    Else
        strVersionInfo = "Versioning is not enabled for this document."
    End If

    MessageBox.Show(strVersionInfo, "Version Information", MessageBoxButtons.OK)
End Sub

Applies to