36

I put a lot of documentation on our SharePoint site, and it all lists as being Checked Out To me. How do I check all of those files in, in one shot?

0
32

Go to Site Settings -> under Site Administration, select "Content and Structure". At the first page there is a list of the files with a "view" in the toolbar on the right section. Drop this down and choose "Checked out to me". Navigate to the folder where the files you wish to check in are located.

This will list all of the files checked out to you in the given directory you are in, and then you can check the checkboxes to select your items and in the actions drop down choose check in. You'll be prompted one time for the comment to check the file in with, so be sure you want to replicate that comment across all selected items for the Version History.

9
  • I did that, and chose Check In, then picking OK on the comment box (tried with and without comment). The files all still showed on the Checked Out To Me list, even after refreshing. May 5 '11 at 0:44
  • are you refreshing before the page refreshes on it's own? This functionality should work as I use it all the time. May 5 '11 at 2:28
  • I'm only refreshing after a long while of waiting. Tried again today, but no luck, though it sure seems like it should work. May 5 '11 at 15:26
  • I noticed that if I'm in a subdirectory on the 'Site Content and Structure' page that it has a title of 'Checked Out To Me' in <'subdirectory'>, but it actually lists all files that are checked out to me. May 5 '11 at 16:36
  • Thats correct the view is not relative path based if I recall correctly. Have you tried checking in just a few files at at time? May 5 '11 at 17:13
6

You can use SharePoint Designer to navigate to the site / Document library. Select all files that need checking in and select Check-in from the Edit menu.

Alternatively use PowerShell as described in this post.

0
5

You can also use the Manage Content and Structure feature if you have the publishing feature turned on.

5

For SP2010 you can find it as below

Site Actions -> Content and structure -> Change View (Checked Out to Me) -> Select all files using checkbox and click on Actions Menu. There's option to checkin.

Thanks,

Ashish Chotalia

4
  • 1
    + for simplicity and nice formatting
    – Iman
    Jan 12 '16 at 5:19
  • check this useful feature from SharePoint designer too . sharepoint.stackexchange.com/a/133493/16880
    – Iman
    Jan 12 '16 at 5:21
  • Not sure why but I cannot find a content and structure option in Site Actions.
    – Shackrock
    Sep 1 '16 at 12:43
  • Are you site collection admin ? Sep 2 '16 at 15:47
1

REASON

The reason for this script is because of the 5000 List View Threshold Limit which prevents mass check-in using the Sharepoint Web GUI.

DESCRIPTION

The Sharepoint Mass File Check In will recursively check in all checked-out files in the specified directory which will also recursively check in files in sub-directories. Note: The checked-out file has to be checked-out to the logged-in user.

USAGE GUIDE

  1. In Sharepoint > Click the Site > Documents > Navigate to the path (It should have AllItems.aspx in the URL)
  2. .\powershell_sharepoint_mass_check_in.ps1 -Sharepoint_Login_Email "username@example.com" -Sharepoint_Site_List_Full_URL_Encoded "https://example.sharepoint.com/sites/Example-Site/Shared%20Documents/Forms/AllItems.aspx?viewid=EXAMPLE&id=%2Fsites%2FExample%2DSite%2FShared%20Documents%2FPersonal%2FTEST%20USER%2FExample%5FExample%2FExample%20%2D%20Work%20Projects%2F%5BExample%5D%20Clients"

FULL DISCLOSURE

I'm the author of this script, do find my other scripts here -> https://github.com/NoPurposeInLife/Sharepoint-Scripts

<#
.SYNOPSIS
    .
.DESCRIPTION
    .
.PARAMETER Path
    The path to the .
.PARAMETER LiteralPath
    Specifies a path to one or more locations. Unlike Path, the value of 
    LiteralPath is used exactly as it is typed. No characters are interpreted 
    as wildcards. If the path includes escape characters, enclose it in single
    quotation marks. Single quotation marks tell Windows PowerShell not to 
    interpret any characters as escape sequences.
#>


# powershell_sharepoint_mass_check_in.ps1
[CmdletBinding()]

PARAM ( 
    [string] $Sharepoint_Site_List_Full_URL_Encoded = $(throw "-Sharepoint_Site_List_Full_URL_Encoded is required."),
    [string] $Sharepoint_Login_Email = $(throw "-Sharepoint_Login_Email is required.")
)



#----------------[ Declarations ]----------------

# Set Error Action
$ErrorActionPreference = "Continue"

#----------------[ Functions ]------------------
Function URL_Decode_String{
    Param(
        [string] $URL_Encoded_String
    )
    
    $URL_Decoded_String = [System.Web.HttpUtility]::UrlDecode($URL_Encoded_String)
    return [string] $URL_Decoded_String
}

Function Get_Sharepoint_Site_URL{
    Param(
        [string] $string_obj_sharepoint_site_list_full_url_decoded
    )
    $system_uri_obj_sharepoint_site_list_full_url_decoded = [System.Uri]$string_obj_sharepoint_site_list_full_url_decoded
    
    $string_obj_sharepoint_site_full_url_decoded = $system_uri_obj_sharepoint_site_list_full_url_decoded.Scheme + "://" + $system_uri_obj_sharepoint_site_list_full_url_decoded.Host + "/" + $system_uri_obj_sharepoint_site_list_full_url_decoded.Segments[1] + $system_uri_obj_sharepoint_site_list_full_url_decoded.Segments[2]
    
    return [string] $string_obj_sharepoint_site_full_url_decoded
}

Function Get_Sharepoint_Folder_Site_Relative_URL{
    Param(
        [string] $string_obj_sharepoint_site_list_full_url_decoded
    )
    
    
    $system_uri_obj_sharepoint_site_list_full_url_decoded = [System.Uri]$string_obj_sharepoint_site_list_full_url_decoded
    
    $string_obj_sharepoint_site_full_url_decoded = "/" + $system_uri_obj_sharepoint_site_list_full_url_decoded.Segments[1] + $system_uri_obj_sharepoint_site_list_full_url_decoded.Segments[2]
    
    $uri_obj_sharepoint_site_list_full_url_decoded = [System.Uri] $string_obj_sharepoint_site_list_full_url_decoded
    
    $system_web_httputility_obj_sharepoint_site_list_full_url_decoded_parsed_query_string = [System.Web.HttpUtility]::ParseQueryString($uri_obj_sharepoint_site_list_full_url_decoded.Query)
    
    $string_obj_sharepoint_site_list_full_url_decoded_id = $system_web_httputility_obj_sharepoint_site_list_full_url_decoded_parsed_query_string['id']
    
    if ([string]::IsNullOrEmpty($string_obj_sharepoint_site_list_full_url_decoded_id)) {
        $string_obj_sharepoint_folder_site_relative_url_decoded = "/" + $system_uri_obj_sharepoint_site_list_full_url_decoded.Segments[3]
        $string_obj_sharepoint_folder_site_relative_url_decoded = $string_obj_sharepoint_folder_site_relative_url_decoded.Substring(0,$string_obj_sharepoint_folder_site_relative_url_decoded.Length-1)
    } else {
        $string_obj_sharepoint_folder_site_relative_url_decoded = "/" + $string_obj_sharepoint_site_list_full_url_decoded_id -replace $string_obj_sharepoint_site_full_url_decoded,""
    }
    
    $string_obj_sharepoint_folder_site_relative_url_decoded = URL_Decode_String -URL_Encoded_String $string_obj_sharepoint_folder_site_relative_url_decoded
    
    return [string] $string_obj_sharepoint_folder_site_relative_url_decoded
}

Function Sharepoint_Authentication{
    Param(
        [string] $string_obj_sharepoint_site_url
    )
    Connect-PnPOnline -Url $string_obj_sharepoint_site_url -UseWebLogin -ForceAuthentication
    return
}

Function Sharepoint_Mass_Check_In{
    Param(
        $pnpcontext_obj_current_pnp_context,
        [string] $Sharepoint_Login_Email,
        [string] $string_obj_sharepoint_folder_site_relative_url    
    )
    
    $folder_obj_sharepoint_folder_items = Get-PnPFolderItem -FolderSiteRelativeUrl $string_obj_sharepoint_folder_site_relative_url
    
    ForEach($item_obj_sharepoint_folder_item in $folder_obj_sharepoint_folder_items)
    {
        
        Write-Host "Name" : $item_obj_sharepoint_folder_item.Name
        Write-Host "UniqueId" : $item_obj_sharepoint_folder_item.UniqueId
        Write-Host "Type" : $item_obj_sharepoint_folder_item.GetType()
 
        $string_obj_sharepoint_item_name = [string] $item_obj_sharepoint_folder_item.Name
        $string_obj_sharepoint_item_type = [string] $item_obj_sharepoint_folder_item.GetType()
        
        
        if ($string_obj_sharepoint_item_type -eq "Microsoft.SharePoint.Client.Folder") {
            
            Write-Host -ForegroundColor Red "Result" : "None"
            Write-Host "---------------------------" 
            $string_obj_sharepoint_folder_site_new_relative_url = $string_obj_sharepoint_folder_site_relative_url + "/" + $string_obj_sharepoint_item_name
            Sharepoint_Mass_Check_In -pnpcontext_obj_current_pnp_context $pnpcontext_obj_current_pnp_context -Sharepoint_Login_Email $Sharepoint_Login_Email -string_obj_sharepoint_folder_site_relative_url $string_obj_sharepoint_folder_site_new_relative_url
        } else {

            $user_obj_sharepoint_folder_item_checked_out_by_user = $item_obj_sharepoint_folder_item.CheckedOutByUser
            
            $pnpproperty_obj_sharepoint_folder_item_check_out_user_email = (Get-PnPProperty -ClientObject $user_obj_sharepoint_folder_item_checked_out_by_user -Property "Email" 2> $null)
            
            $string_obj_sharepoint_folder_item_check_out_user_email = [string] $pnpproperty_obj_sharepoint_folder_item_check_out_user_email
                            
            # Check if the file is checked out
            If (($item_obj_sharepoint_folder_item.CheckOutType -ne "None") -And ($string_obj_sharepoint_folder_item_check_out_user_email -eq $Sharepoint_Login_Email)) {

                $item_obj_sharepoint_folder_item.CheckIn("File Checked In.",[Microsoft.SharePoint.Client.CheckinType]::MinorCheckIn)
                $pnpcontext_obj_current_pnp_context.ExecuteQuery()
                Write-Host -ForegroundColor Green "Result" : "File Checked In."
                Write-Host "---------------------------" 
            } else {
                Write-Host -ForegroundColor Red "Result" : "File Not Checked Out or Login Email Does Not Match Checked Out To Email"
                Write-Host "---------------------------" 
            }
        }
    }
    
    
    return
}

Function Main{
    Param(
        [string] $string_obj_sharepoint_site_list_full_url_encoded,
        [string] $Sharepoint_Login_Email
    )
    
    try {  
        # URL Decode Sharepoint URL
        $string_obj_sharepoint_site_list_full_url_decoded = URL_Decode_String -URL_Encoded_String $string_obj_sharepoint_site_list_full_url_encoded
        
        # Get Sharepoint Site URL
        $string_obj_sharepoint_site_url = Get_Sharepoint_Site_URL -string_obj_sharepoint_site_list_full_url_decoded $string_obj_sharepoint_site_list_full_url_decoded
        
        Write-Host -ForegroundColor Green "Sharepoint Site URL" :  $string_obj_sharepoint_site_url
        
        # Get Sharepoint Folder Site Relative URL
        $string_obj_sharepoint_folder_site_relative_url = Get_Sharepoint_Folder_Site_Relative_URL -string_obj_sharepoint_site_list_full_url_decoded $string_obj_sharepoint_site_list_full_url_decoded
        
        Write-Host -ForegroundColor Green "Sharepoint Relative URL" : $string_obj_sharepoint_folder_site_relative_url
        
        # Authenticate to Sharepoint
        Sharepoint_Authentication -string_obj_sharepoint_site_url $string_obj_sharepoint_site_url
        
        # Get Current PNP Context
        $pnpcontext_obj_current_pnp_context = Get-PnPContext
        
        # Sharepoint Mass Check In
        Write-Host "---------------------------" 
        Sharepoint_Mass_Check_In -pnpcontext_obj_current_pnp_context $pnpcontext_obj_current_pnp_context -Sharepoint_Login_Email $Sharepoint_Login_Email -string_obj_sharepoint_folder_site_relative_url $string_obj_sharepoint_folder_site_relative_url
        

    } catch {  
        $e = $_.Exception
        $line = $_.InvocationInfo.ScriptLineNumber
        $msg = $e.Message 

        Write-Host -ForegroundColor Red "caught exception: $e at $line" 
    }
}

#----------------[ Imports ]---------------
if (!(Get-Module "PnP.PowerShell")) {
    Install-Module SharePointPnPPowerShellOnline
}
Add-Type -AssemblyName System.Web

#----------------[ Main Execution ]---------------
Main -Sharepoint_Login_Email $Sharepoint_Login_Email -string_obj_sharepoint_site_list_full_url_encoded $Sharepoint_Site_List_Full_URL_Encoded

Not the answer you're looking for? Browse other questions tagged or ask your own question.