Tendani
Tendani

Reputation: 1

Checked out documents in SharePoint 2013

Good day,

Please help, I am working on SharePoint 2013 and a user wants to know all the document that she has checked out on the entire SharePoint site not only on one Library, how can I achieve this?.

Upvotes: 0

Views: 1248

Answers (2)

EchoDu_MSFT
EchoDu_MSFT

Reputation: 621

Please run the below PowerShell script to list the checked-out files from one site collection:

Add-PSSnapin Microsoft.Sharepoint.Powershell –EA 0

$SiteUrl="http://sp/sites/sitename/"
$Report="c:\temp\checked-outfilesreport.csv"
    
#Get the site collection 
$site=Get-SPSite $SiteUrl

#Write the CSV Header - Tab Separated
"Site Collection Name `t Site Name`t Library `t File Name `t File URL `t  Last Modified `t Checked-Out By" | Out-file $Report
        
#Loop through each site in the site collection
ForEach($Web in $Site.AllWebs){
     #Loop through each document library
     Foreach ($List in $Web.GetListsOfType([Microsoft.SharePoint.SPBaseType]::DocumentLibrary)){
         #Get only Document Libraries
         if ($List.Hidden -eq $false){
             #Loop through each Item
             foreach($ListItem in $List.Items){
                 If( ($ListItem.File.CheckOutStatus -ne "None") -and ($ListItem.File.CheckedOutByUser -ne $null)){
                     #Log the data to a CSV file
                     "$($Site.RootWeb.Title) `t $($Web.Title) `t $($List.Title) `t $($ListItem.Name) `t $($Web.Url)/$($ListItem.Url) `t  $($ListItem['Modified'].ToString()) `t  $($ListItem.File.CheckedOutByUser)" | Out-File $Report -Append
                 }
             }
             Write-Host "Successfully!"
         }
     }
}

enter image description here

enter image description here

enter image description here

Upvotes: 1

Abhijeet Jadhav
Abhijeet Jadhav

Reputation: 342

Please find below PowerShell script to find the checked-out files.

#Add PowerShell Snapin
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Function to find CheckedOutFiles
Function CheckedOutFiles()
{ 
#Define 'Web Application URL' as Mandatory Parameter
Param([Parameter(Mandatory=$true)] [string]$WebAppURL,
[Parameter(Mandatory=$true)] [string]$ReportOutput
)

#Get the Web Application
$WebApp = Get-SPWebApplication $WebAppURL

#Write the CSV Header - Tab Separated
"Site Collection Name `t Site Name`t Library `t File Name `t File URL `t  Last Modified `t Checked-Out By" | Out-file $ReportOutput

#Arry to Skip System Lists and Libraries
$SystemLists =@("Converted Forms", "Master Page Gallery", "Customized Reports", "Form Templates", "List Template Gallery", "Theme Gallery",
       "Reporting Templates", "Solution Gallery", "Style Library", "Web Part Gallery","Site Assets", "wfpub")

#Loop through each site collection
ForEach($Site in $WebApp.Sites)
{
    #Loop through each site in the site collection
    ForEach($Web in $Site.AllWebs)
    {
        Write-host "Processing Site:" $web.Url
        #Loop through each document library
        Foreach ($List in $Web.GetListsOfType([Microsoft.SharePoint.SPBaseType]::DocumentLibrary))
        {
            #Get only Document Libraries & Exclude Hidden System libraries
            if ( ($List.Hidden -eq $false) -and ($SystemLists -notcontains $List.Title) )
            {
                #Loop through each Item
                foreach ($ListItem in $List.Items)
                {
                    If( ($ListItem.File.CheckOutStatus -ne "None") -and ($ListItem.File.CheckedOutByUser -ne $null))
                    {
                        #Log the data to a txt file
                        "$($Site.RootWeb.Title) `t $($Web.Title) `t $($List.Title) `t $($ListItem.Name) `t $($Web.Url)/$($ListItem.Url) `t  $($ListItem['Modified'].ToString()) `t  $($ListItem.File.CheckedOutByUser)" | Out-File $ReportOutput -Append
                        Write-host -f Yellow "Found a Checked out file at: $($Web.Url)/$($ListItem.Url)"
   

                    }
                }
            }
        }
    }
}

#Send message to output console
write-host -f Green "Checked out Files Report Generated Successfully!"
}

   #Call the Function to Get Checked-Out Files
 CheckedOutFiles -WebAppURL "<your sharepoint site>" -ReportOutput "C:\CheckedOutReport.txt"

Upvotes: 0

Related Questions