Skip to main content
replaced http://sharepoint.stackexchange.com/ with https://sharepoint.stackexchange.com/
Source Link

This one works for me. Thanks pholparpholpar

$impitem = $impweb.GetListItem('http://sp2013/XXXXXXXXXXXXXX.xlsx');
$impFile = $impItem.File
$ft = New-Object System.TimeSpan(10000);
$impfile.Lock([Microsoft.SharePoint.SPFile+SPLockType]::Exclusive, "test lock", $ft)
$impfile.UndoCheckOut();
$impfile.Delete();

This one works for me. Thanks pholpar

$impitem = $impweb.GetListItem('http://sp2013/XXXXXXXXXXXXXX.xlsx');
$impFile = $impItem.File
$ft = New-Object System.TimeSpan(10000);
$impfile.Lock([Microsoft.SharePoint.SPFile+SPLockType]::Exclusive, "test lock", $ft)
$impfile.UndoCheckOut();
$impfile.Delete();

This one works for me. Thanks pholpar

$impitem = $impweb.GetListItem('http://sp2013/XXXXXXXXXXXXXX.xlsx');
$impFile = $impItem.File
$ft = New-Object System.TimeSpan(10000);
$impfile.Lock([Microsoft.SharePoint.SPFile+SPLockType]::Exclusive, "test lock", $ft)
$impfile.UndoCheckOut();
$impfile.Delete();
Source Link

This one works for me. Thanks pholpar

$impitem = $impweb.GetListItem('http://sp2013/XXXXXXXXXXXXXX.xlsx');
$impFile = $impItem.File
$ft = New-Object System.TimeSpan(10000);
$impfile.Lock([Microsoft.SharePoint.SPFile+SPLockType]::Exclusive, "test lock", $ft)
$impfile.UndoCheckOut();
$impfile.Delete();