Do you confirm there is no checked out files?

Last updated by Jean Thirion [SSW] 7 months ago.See history

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.

sp docs
Figure: Here Greg Harris has not checked in a file

There are 2 ways to remind users of their "checked out files":

  • Solution A: Use Powershell scripts (see PNP.github.io sample)
  • Solution B: Custom application report (Includes some low-code work) E.g. SSW.Dory

Solution A. Powershell scripts

  1. Create a new PowerShell Script
#Config Variables
$SiteURL = "https://crescent.sharepoint.com/sites/marketing"
$CSVFilePath = "C:\Temp\CheckedOutFiles.csv"
 
#Connect to PnP Online
Connect-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 libraries
ForEach ($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 file
    ForEach ($File in $FilesCheckedOut) 
    {
        $CheckedOutFiles += [PSCustomObject][ordered]@{
            Library         = $List.Title
            FileName        = $File.FieldValues.FileLeafRef
            CheckedOutTo    = $File.FieldValues.CheckoutUser.LookupValue
            Location        = $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

  1. Run the PowerShell script
  2. Go chase after the users.

Solution B. Custom application report (Includes some low-code work)

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.

Figure: An example of the reminder email that all users receive

We open source. Powered by GitHub