SPFileVersion class

Represents a version of an SPFile object.

Inheritance hierarchy


Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)


Public Class SPFileVersion
Dim instance As SPFileVersion
public class SPFileVersion


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.

Thread safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See also


SPFileVersion members

Microsoft.SharePoint namespace