如何在 SharePoint 2010 中批量签入所有签出的文档

How to bulk check in all checked out documents in SharePoint 2010

我有 SharePoint 2010 环境。许多文档已被其他用户签出。

我需要批量签入这些文件。任何人都可以向我推荐一个可靠的方法吗?

谢谢

你可以试试下面的PowerShell。

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
  
#Variables
$WebURL="http://domain/sites/emilytest"
$LibraryURL="/Shared%20Documents" #Relative URL of a folder or library
 
#Get Objects
$Web = Get-SPWeb $WebURL
$Folder = $web.GetFolder($LibraryURL)
 
#Function to find all checked out files in a SharePoint library
Function CheckIn-CheckedOutFiles($Folder)
{
 
    $Folder.Files | Where { $_.CheckOutStatus -ne "None" }  | ForEach-Object {
    write-host ($_.Name,$_.URL,$_.CheckedOutBy)
 
    #To Check in
    $_.Checkin("Checked in by Administrator")
    }
 
   #Process all sub folders
   $Folder.SubFolders | ForEach-Object {
   CheckIn-CheckedOutFiles $_
   }
}
 
#Call the function to find checkedout files
CheckIn-CheckedOutFiles $Folder