SPFileVersionCollection Class
The SPFileVersionCollection class represents a collection of SPFileVersion objects.
System.Object
Microsoft.SharePoint.SPBaseCollection
Microsoft.SharePoint.SPFileVersionCollection
Public Methods
The following table shows the public methods of the SPFileVersionCollection class and a brief description of each.
Name | Description |
---|---|
Delete | Deletes the file version object at the specified index in the collection. |
DeleteAll | Deletes all the file version objects in the collection. |
DeleteByID | Deletes the file version object with the specified integer ID from the collection. |
GetVersionFromID | Returns the file version object with the specified ID. |
Restore | Restores the file version object at the specified index in the collection. |
RestoreByID | Restores the file version object with the specified integer ID to the collection. |
Public Properties
The following table shows the public properties of the SPFileVersionCollection class, the data type of each property, and a brief description of each.
Name | Data Type | Description |
---|---|---|
Count | Int32 | Gets the number of file version objects in the collection. |
File | Microsoft.SharePoint.SPFile | Gets the parent file object for the collection. |
Item | Microsoft.SharePoint.SPFile | Gets the file version object at the specified index in the collection. |
Web | Microsoft.SharePoint.SPWeb | Gets the SharePoint site to which the parent file for the collection belongs. |
Thread Safety
Any public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread safe.
Remarks
Use the Versions property of the SPFile class to return the collection of versions for a file.
Use an indexer to return a single version from the collection. For example, assuming the collection is assigned to a variable named myVersions, use myVersions[index]
in C#, or myVersions(index)
in Visual Basic .NET, where index is the index number of the version in the collection.
Requirements
Namespace: Microsoft.SharePoint
Platforms: Microsoft Windows Server 2003
Assembly: Windows SharePoint Services (in Microsoft.SharePoint.dll)
Security: Code Access Security