One of the annoying things with SharePoint document and page libraries is that users often accidentally leave checked out files, that prevents others from modifying them.
Suggestion to Microsoft: send an email to the user to remind them they have outstanding checkouts potentially blocking other users.
Figure: Here Greg Harris has not checked in a file
There are 2 ways to remind users of their "checked out files":
#Config Variables$SiteURL = "https://crescent.sharepoint.com/sites/marketing"$CSVFilePath = "C:\Temp\CheckedOutFiles.csv"#Connect to PnP OnlineConnect-PnPOnline -Url $SiteURL -Credentials (Get-Credential)#Get all document libraries$CheckedOutFiles = @()$DocumentLibraries = Get-PnPList | Where-Object {$_.BaseType -eq "DocumentLibrary" -and $_.Hidden -eq $False}#Iterate through document librariesForEach ($List in $DocumentLibraries){Write-host "Processing Library:"$List.Title -f Yellow#Get All Checked out Files of the library$FilesCheckedOut = Get-PnPListItem -List $List -PageSize 500 | Where {$_["CheckoutUser"] -ne $Null}#Collect data from each checked-out fileForEach ($File in $FilesCheckedOut){$CheckedOutFiles += [PSCustomObject][ordered]@{Library = $List.TitleFileName = $File.FieldValues.FileLeafRefCheckedOutTo = $File.FieldValues.CheckoutUser.LookupValueLocation = $File.FieldValues.FileRef}}}#Export Checked out Files data to CSV File$CheckedOutFiles$CheckedOutFiles | Export-Csv -Path $CSVFilePath -NoTypeInformation
To run the script against your entire tenant, see PNP.github.io sample
Learn more: SSW.Dory
To make reminding users easier, we have created a Power Automate flow called SSW.Dory that will find checked out files and send out a notification email to all the naughty people automatically every day.
You currently have the following pages checked out in SharePoint:
> ‘Done - x files checked in’
Note: See all files you have checked out at {{ LINK TO CHECKED OUT LIST }}
-- Powered by Power Automate, Job: SSW.Dory
Figure: An example of the reminder email that all users receive