Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SPFileVersion class
Collapse the table of content
Expand the table of content

SPFileVersion class

Represents a version of an SPFile object.

System.Object
  Microsoft.SharePoint.SPFileVersion

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

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.

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