共用方式為


SPFile.Lock method

建立檔案,對其進行修改時,防止其他使用者鎖定。

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'宣告
Public Sub Lock ( _
    lockType As SPFile.SPLockType, _
    lockId As String, _
    timeout As TimeSpan _
)
'用途
Dim instance As SPFile
Dim lockType As SPFile.SPLockType
Dim lockId As String
Dim timeout As TimeSpan

instance.Lock(lockType, lockId, timeout)
public void Lock(
    SPFile.SPLockType lockType,
    string lockId,
    TimeSpan timeout
)

參數

Exceptions

Exception Condition
SPFileLockException

lockType是None

備註

您可以判斷檔案是否已藉由檢查LockType屬性已經鎖定。如果是None,檔案將不會鎖定。

請參閱

參照

SPFile class

SPFile members

Microsoft.SharePoint namespace

ReleaseLock(String)

RefreshLock(String, TimeSpan)

LockType