您的位置:首页 > 运维架构 > Shell

Restore list by name from recyclebin via powershell

2013-07-05 17:57 501 查看

Restore list by name from recyclebin via powershell

##############################################

# $url : The site url #

#$name : The list name #

#Example : RestoreListByName "http://localhost" "list1" #

##############################################

#  Import the Microsoft.SharePoint.PowerShell

if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null )
{
Add-PSSnapin Microsoft.SharePoint.PowerShell
}

function RestoreListByName($url, $name)
{

$spWeb = Get-SPWeb -identity $url
$spList  = $spWeb.RecycleBin |?{$_.Title -match $name}
$spWeb.RecycleBin.Restore($spList.Id)
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐