共用方式為


SPFileVersionCollection.RestoreByID Method (Int32)

Restores the file version object that has the specified ID to the collection.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Sub RestoreByID ( _
    vid As Integer _
)
'Usage
Dim instance As SPFileVersionCollection
Dim vid As Integer

instance.RestoreByID(vid)
public void RestoreByID(
    int vid
)

Parameters

Remarks

If versioning is enabled for the document library and the file is not checked out, the current file becomes the most recent version when a version is restored.

Using the RestoreByID method is the same as using a combination of the OpenBinary method of the SPFileVersion class and the SaveBinary method of the SPFile class, as in myVersion.File.SaveBinary(myVersions[5].OpenBinary). However, the RestoreByID method is more efficient.

See Also

Reference

SPFileVersionCollection Class

SPFileVersionCollection Members

RestoreByID Overload

Microsoft.SharePoint Namespace