Add-PSSnapin Microsoft.SharePoint.PowerShell
function CheckInDocument([string]$url){
$spWeb=Get-SPWeb $url
$spDocument=$spWeb.Lists.TryGetList("Documents");
Write-Host "需要签入文件的文档库:$($spDocument.Title)"
$files=$spDocument.CheckedOutFiles
Write-Host "需要签入的文件个数:$($files.Count)"
$files|where{$_.CheckOutStatus -ne "None"}|%{
$_.TakeOverCheckOut();
$docItem=$spDocument.GetItemById( $_.ListItemId);
$docItem.File.CheckIn("Administrator Check In");
Write-Host "$($docItem.File.Name) Check In" -ForegroundColor Green
}
$spWeb.Dispose();
}
CheckInDocument("http://reus");