博客地址:http://blog.csdn.net/shelleyliu0415
前段时间给大家回复问题的时候,遇到一个需求:如何在开启“Require Check Out”设置的Library下批量check in文件。
问题描述:由于Library开启了“RequireCheck Out”设置,导致很多Documents在同步到Library时,自动被Check Out,因为documents存储在不同的folder下,希望一次性把这些documents变为check in
解决方案: 用PowerShell的cmdlet对documents进行批量check in,具体步骤如下:
$WebURL="http://cpshelley:9001/sites/Project_Shelley"
$LibraryName="shelley"
$Web = Get-SPWeb $WebURL
$CheckedOu$DocLib =$Web.Lists.TryGetList($LibraryName)
$CheckedOutFiles = $DocLib.Items | Where-Object {$_.File.CheckOutStatus -ne "None"}
ForEach($item in $CheckedOutFiles) {$DocLib.GetItemById($item.Id).file.CheckIn("Checked in bycp01\administrator") }
谢谢阅读!