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
)
參數
lockType
Type: Microsoft.SharePoint.SPFile.SPLockType其中一個列舉值,描述鎖定的型別。
lockId
Type: System.String識別項 (ID) 鎖定。
timeout
Type: System.TimeSpan鎖定的持續期間。
Exceptions
Exception | Condition |
---|---|
SPFileLockException | lockType是None。 |
備註
您可以判斷檔案是否已藉由檢查LockType屬性已經鎖定。如果是None,檔案將不會鎖定。