Forum Discussion
Jussi Palo
Feb 15, 2017Iron Contributor
Office PnP PowerShell: Get file CheckOutStatus
How to check for publishing page's CheckOutStatus? # Get pages
foreach($page in Get-PnPListItem -Web $subweb -List "pages" -Fields "FileRef" | Where { $_.FieldValues.FSObjType -eq...
Pete Gilchrist
Mar 28, 2018Copper Contributor
I have managed to get the checked out status of a file this way :
$lists = Get-PnPList
foreach ($list in $lists | where {$_.Title -eq "Site Pages" -or $_.Title -eq "Documents"})
{
$Items = Get-PnPListItem -List $list
foreach ($Item in $Items)
{
if ($Item.FieldValues.CheckoutUser -ne $null)
{
write-host $list.Title -ForegroundColor Green
write-host ($Item.FieldValues).FileLeafRef -ForegroundColor Yellow
write-host $Item.FieldValues.CheckoutUser.Email -ForegroundColor Red
}
}
}
If the item is checked out (in either "Site Pages" or "Documents", in this example), this script will show you the filename, and the email of the person who has it checked out.