In Powershell i get all checked out file from a library with
foreach($f in $lib.CheckedOutFiles){
//I tried to retrieve item with
$item = $lib.GetItemById($f.ListItemID)//exception item not retrieve
}
How can i checkin spcheckedoutfile?
SOLUTION
I finally found a solution. For having item i have to do a TakeOverCheckOut before and after i can have item and file to checkin
foreach ($item in $lib.CheckedOutFiles) {
write-Host $item.ListitemId
$item.TakeOverCheckOut()//to retrieve item i have to do this before
$doc = $lib.getItemById($item.ListitemId)
$itemFile = $doc.File
if($itemFile -ne $null){
$itemFile.CheckIn("Checked In By Administrator for achive")
write-Host " Checked In" -ForeGroundColor Green
}
}