共用方式為


SPFileVersionCollection.DeleteByLabel Method

Deletes the file version object with 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
<ClientCallableAttribute> _
<ClientCallableExceptionConstraintAttribute(FixedId := "6", ErrorType := GetType(SPException),  _
    ErrorCode := , Condition := "The current version cannot be deleted.")> _
<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 := "2", ErrorType := GetType(SPQueryThrottledException),  _
    ErrorCode := , Condition := "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "3", ErrorType := GetType(SPQueryThrottledException),  _
    ErrorCode := , Condition := "Not enough resources are available to process this command.")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "4", ErrorType := GetType(FileNotFoundException),  _
    Condition := "The specified version label is invalid.")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "5", ErrorType := GetType(UnauthorizedAccessException),  _
    Condition := "Lack of permissions to perform the operation")> _
Public Sub DeleteByLabel ( _
    versionlabel As String _
)
'Usage
Dim instance As SPFileVersionCollection
Dim versionlabel As String

instance.DeleteByLabel(versionlabel)
[ClientCallableAttribute]
[ClientCallableExceptionConstraintAttribute(FixedId = "6", ErrorType = typeof(SPException), 
    ErrorCode = , Condition = "The current version cannot be deleted.")]
[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 = "2", ErrorType = typeof(SPQueryThrottledException), 
    ErrorCode = , Condition = "The attempted operation is prohibited because it exceeds the list view threshold enforced by the administrator.")]
[ClientCallableExceptionConstraintAttribute(FixedId = "3", ErrorType = typeof(SPQueryThrottledException), 
    ErrorCode = , Condition = "Not enough resources are available to process this command.")]
[ClientCallableExceptionConstraintAttribute(FixedId = "4", ErrorType = typeof(FileNotFoundException), 
    Condition = "The specified version label is invalid.")]
[ClientCallableExceptionConstraintAttribute(FixedId = "5", ErrorType = typeof(UnauthorizedAccessException), 
    Condition = "Lack of permissions to perform the operation")]
public void DeleteByLabel(
    string versionlabel
)

Parameters

Remarks

This method clears the file version information from the collection.

See Also

Reference

SPFileVersionCollection Class

SPFileVersionCollection Members

Microsoft.SharePoint Namespace