Share via


SPFileVersion Class

Represents a version of an SPFile object.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.SPFileVersion

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

Syntax

<SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel := True)> _
<SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel := True)> _
Public Class SPFileVersion

Dim instance As SPFileVersion
[SharePointPermissionAttribute(SecurityAction.LinkDemand, ObjectModel = true)]
[SharePointPermissionAttribute(SecurityAction.InheritanceDemand, ObjectModel = true)]
public class SPFileVersion

Remarks

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

Reference

SPFileVersion Members

Microsoft.SharePoint Namespace