Represents a version of an SPFile object.
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
When a file becomes a version, its properties are maintained with the version. This includes the check-in comment and other information for the file.
Use the Versions property of the SPFile class to return an SPFileVersionCollection object that represents the collection of versions for a file. Use an indexer to return a single version from the collection. For example, if the collection is assigned to a variable named collVersions, use collVersions[index] in C#, or collVersions(index) in Visual Basic, where index is the index number of the version in the collection. Otherwise, use the GetVersionFromID method to return a single version from the collection.
If file versioning is enabled for a document library, calling the CheckIn method of the SPFile class after using the CheckOut method creates a version of the file. In the same way, calling the SaveBinary method of the SPFile class also creates a version.