Test-KFItemLock

Syntax

Test-KFItemLock 
  [-Handle] <handle> 
  [-ThrowErrors[:$true]]

Support

>= kenaflow 2.0.3

Return

Boolean.

$true => <handle> is valid. The lock exists and "you" own it.

$false => <handle> is invalid or does not exist or "you" do not own it.

Description

This can be used to test an previously gathered lock handle for a SharePoint list item.

Please read this article for further details: Locking.

Parameters

[-Handle] <handle>

This is a lock handle gathered with Lock-KFItem.

[-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."
}