Lock-KFItem
Syntax
Lock-KFItem
-Item <sharepoint-list-item>
[-MaxWaitInSeconds <seconds> (5)]
[-ThrowErrors[:$true]]
Support
>= kenaflow 2.0.3
Return
$null
on failure.
A lock handle (-ne $null
) on success.
Description
Used to lock a SharePoint list item manually.
Please read this article for further details: Locking
Parameters
[-Item] <sharepoint-list-item>
SharePoint list item that needs to be locked.
[-MaxWaitInSeconds <wait-time> (5)]
Specified (in seconds), how long the workflow waits for the lock if it already registered.
Default: 5 seconds.
[-ThrowErrors[:$true]]
This is a default parameter for all kenaflow cmdlets. If set to
$true
(default!) the engine will pass exception within the cmdlet to the script for further handling.
Example
$item = Get-PnPListItem -List "Custom List" -Id 1
$lock = Lock-KFItem -Item $item -MaxWaitInSeconds 10
if( $lock -ne $null ) {
Test-KFItemLock -Handle $lock
Unlock
} else {
Write-KFLog "Cannot get a handle to the SharePoint list item."
}