共用方式為


SPFileVersionCollection.DeleteByID Method

Removes the file version object with the specified integer ID from the collection.

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

Syntax

'Declaration
<ClientCallableExceptionConstraintAttribute(FixedId := "2", ErrorType := GetType(SPQueryThrottledException),  _
    ErrorCode := , Condition := "Not enough resources are available to process this command.")> _
<ClientCallableAttribute> _
<ClientCallableExceptionConstraintAttribute(FixedId := "1", 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(FileNotFoundException),  _
    Condition := "The specified version label is invalid.")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "4", ErrorType := GetType(UnauthorizedAccessException),  _
    Condition := "Lack of permissions to perform the operation")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "5", ErrorType := GetType(SPException),  _
    ErrorCode := , Condition := "The current version cannot be deleted.")> _
Public Sub DeleteByID ( _
    vid As Integer _
)
'Usage
Dim instance As SPFileVersionCollection
Dim vid As Integer

instance.DeleteByID(vid)
[ClientCallableExceptionConstraintAttribute(FixedId = "2", ErrorType = typeof(SPQueryThrottledException), 
    ErrorCode = , Condition = "Not enough resources are available to process this command.")]
[ClientCallableAttribute]
[ClientCallableExceptionConstraintAttribute(FixedId = "1", 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(FileNotFoundException), 
    Condition = "The specified version label is invalid.")]
[ClientCallableExceptionConstraintAttribute(FixedId = "4", ErrorType = typeof(UnauthorizedAccessException), 
    Condition = "Lack of permissions to perform the operation")]
[ClientCallableExceptionConstraintAttribute(FixedId = "5", ErrorType = typeof(SPException), 
    ErrorCode = , Condition = "The current version cannot be deleted.")]
public void DeleteByID(
    int vid
)

Parameters

Remarks

This method removes the file version information from the collection.

See Also

Reference

SPFileVersionCollection Class

SPFileVersionCollection Members

Microsoft.SharePoint Namespace