Partilhar via


SPFileVersionCollection.RestoreByLabel Method

Restores the file version object that has the specified version label.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallableExceptionConstraintAttribute(FixedId := "7", ErrorType := GetType(UnauthorizedAccessException),  _
    Condition := "Lack of permissions to perform the operation")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "2", ErrorType := GetType(SPQueryThrottledException),  _
    ErrorCode := , Condition := "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.")> _
<ClientCallableAttribute> _
<ClientCallableExceptionConstraintAttribute(FixedId := "1", ErrorType := GetType(ArgumentException),  _
    Condition := "Version label MUST be the return value from VersionLabel property of a Microsoft.Sharepoint.Client.FileVersion object.")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "4", ErrorType := GetType(SPException),  _
    ErrorCode := , Condition := "Operation is not valid due to the current state of the object. The attempted operation is prohibited because the published version is greater than the attempted restore version.")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "6", ErrorType := GetType(SPException),  _
    ErrorCode := , Condition := "The attempted operation is prohibited because the document is checked out for editing by another user.")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "3", ErrorType := GetType(SPQueryThrottledException),  _
    ErrorCode := , Condition := "Not enough resources are available to process this command.")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "5", ErrorType := GetType(DirectoryNotFoundException),  _
    Condition := "The specified version label is invalid.")> _
Public Sub RestoreByLabel ( _
    versionlabel As String _
)
'Usage
Dim instance As SPFileVersionCollection
Dim versionlabel As String

instance.RestoreByLabel(versionlabel)
[ClientCallableExceptionConstraintAttribute(FixedId = "7", ErrorType = typeof(UnauthorizedAccessException), 
    Condition = "Lack of permissions to perform the operation")]
[ClientCallableExceptionConstraintAttribute(FixedId = "2", ErrorType = typeof(SPQueryThrottledException), 
    ErrorCode = , Condition = "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.")]
[ClientCallableAttribute]
[ClientCallableExceptionConstraintAttribute(FixedId = "1", ErrorType = typeof(ArgumentException), 
    Condition = "Version label MUST be the return value from VersionLabel property of a Microsoft.Sharepoint.Client.FileVersion object.")]
[ClientCallableExceptionConstraintAttribute(FixedId = "4", ErrorType = typeof(SPException), 
    ErrorCode = , Condition = "Operation is not valid due to the current state of the object. The attempted operation is prohibited because the published version is greater than the attempted restore version.")]
[ClientCallableExceptionConstraintAttribute(FixedId = "6", ErrorType = typeof(SPException), 
    ErrorCode = , Condition = "The attempted operation is prohibited because the document is checked out for editing by another user.")]
[ClientCallableExceptionConstraintAttribute(FixedId = "3", ErrorType = typeof(SPQueryThrottledException), 
    ErrorCode = , Condition = "Not enough resources are available to process this command.")]
[ClientCallableExceptionConstraintAttribute(FixedId = "5", ErrorType = typeof(DirectoryNotFoundException), 
    Condition = "The specified version label is invalid.")]
public void RestoreByLabel(
    string versionlabel
)

Parameters

See Also

Reference

SPFileVersionCollection Class

SPFileVersionCollection Members

Microsoft.SharePoint Namespace