在SharePoint 2010中用PowerShell签入文档

一段简短的脚本,来自于http://secretsofsharepoint.com/cs/网站,用于签入文档。通过PowerShell脚本操作文档库。

 

function CheckInDocument([string]$url)
{
$spWeb = Get-SPWeb $url
$getFolder = $spWeb.GetFolder("Shared Documents")
$getFolder.Files | Where { $_.CheckOutStatus -ne "None" } | ForEach {
Write-Host "$($_.Name) 已被: $($_.CheckedOutBy)  签出"
$_.CheckIn("被管理员签入")
Write-Host  "$($_.Name) 已签入" -ForeGroundColor Green
}
$spWeb.Dispose()
}

 

使用该脚本的例子:

 

CheckInDocument http://SP2010u/it

 

运行结果:

查看该文档的版本记录:

参考资料

Check in documents with PowerShell SharePoint 2010

posted @ 2010-08-26 09:53  Sunmoonfire  阅读(133)  评论(0编辑  收藏  举报