SPFileVersionCollection.Restore Method
Restores the file version object at the specified index in 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 Restore ( _
iIndex As Integer _
)
'Usage
Dim instance As SPFileVersionCollection
Dim iIndex As Integer
instance.Restore(iIndex)
public void Restore(
int iIndex
)
Parameters
iIndex
Type: System.Int32The index of the version to restore.
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 Restore 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 Restore method is more efficient.