博客地址: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") }
謝謝閱讀!