sharepoint 删除list里的所有内容

[System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")


$siteUrl = "http://oa-vsvr-a/sites/NewWFCenter/"

$webName = "OverTimeProcess"

$listName = "Holiday"

$site=Get-SPSite($siteUrl)

$web=$site.openweb($webName)

$list=$web.Lists[$listName]

$items=$list.Items

Write-Host  $items.Count  

$items|%{$list.GetItemById($_.Id).Delete()}  

$web.Dispose()

$site.Dispose()

上面的 $siteUrl是site的地址;$webName就是web的名称;$listName即list的名称。这些脚本需要在sharepoint 管理工具(类似cmd.exe的东东)里面敲;

 

 

 

 

 

 

 

<个人积累,转载请注明出处>

posted on 2016-05-18 17:46  红色的一帆风顺  阅读(173)  评论(0编辑  收藏  举报

导航