共用方式為


SPFile.CheckOut Method (SPFile.SPCheckOutType, String)

Checks out the file from a document library by specifying the type of checkout and by specifying that the file should not be checked out if it has been modified after a particular date.

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

Syntax

'Declaration
<ClientCallableExceptionConstraintAttribute(FixedId := "1", ErrorType := GetType(SPFileCheckOutException),  _
    ErrorCode := , Condition := "The file is already checked out for editing.")> _
<ClientCallableAttribute> _
<ClientCallableExceptionConstraintAttribute(FixedId := "2", ErrorType := GetType(SPFileCheckOutException),  _
    ErrorCode := , Condition := "The operation on the file cannot be completed because the specified checkout arguments are not valid.")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "3", ErrorType := GetType(UnauthorizedAccessException),  _
    Condition := "Insufficient permissions to perform operation")> _
Public Sub CheckOut ( _
    checkOutType As SPFile.SPCheckOutType, _
    lastModifiedDate As String _
)
'Usage
Dim instance As SPFile
Dim checkOutType As SPFile.SPCheckOutType
Dim lastModifiedDate As String

instance.CheckOut(checkOutType, lastModifiedDate)
[ClientCallableExceptionConstraintAttribute(FixedId = "1", ErrorType = typeof(SPFileCheckOutException), 
    ErrorCode = , Condition = "The file is already checked out for editing.")]
[ClientCallableAttribute]
[ClientCallableExceptionConstraintAttribute(FixedId = "2", ErrorType = typeof(SPFileCheckOutException), 
    ErrorCode = , Condition = "The operation on the file cannot be completed because the specified checkout arguments are not valid.")]
[ClientCallableExceptionConstraintAttribute(FixedId = "3", ErrorType = typeof(UnauthorizedAccessException), 
    Condition = "Insufficient permissions to perform operation")]
public void CheckOut(
    SPFile.SPCheckOutType checkOutType,
    string lastModifiedDate
)

Parameters

  • lastModifiedDate
    Type: System.String

    The date when the file was last modified; can be a null reference (Nothing in Visual Basic).

Exceptions

Exception Condition
SPFileCheckOutException

checkOutType is None.

SpException

The lastModifiedDate parameter is not null and the value does not match the value of the TimeLastModified property, which is when the file was last modified.

-or-

An error occurred while checking out the file.

See Also

Reference

SPFile Class

SPFile Members

CheckOut Overload

Microsoft.SharePoint Namespace