Because a document library has the edit checkout feature set, the default state of the files is checked out when the files are bulk imported. If the manual check-in is time-consuming and laborious, the PowerShell is used to implement the bulk check-in documents in the document library.
Resolution
Add-pssnapin Microsoft.SharePoint.PowerShell
function Checkindocument ([string] $url) {
$spWeb =get-spweb $ URL
$spDocument = $spWeb. Lists.trygetlist ("Documents");
Write-host Document library to check in Files: $ ($spDocument. Title) "
$files = $spDocument. Checkedoutfiles
Write-host" The number of files that need to be checked in: $ ( $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");
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/web/sharepoint/