首页 > 代码库 > [存储记录]SharePoint循环删除任务

[存储记录]SharePoint循环删除任务

$spWeb =get-spweb http://.....
$spList =$spWeb.GetListFromUrl("http://..../Lists/Tasks/AllItems.aspx")
$spQuery = New-Object Microsoft.SharePoint.SPQuery
$camlQuery = ‘<Where><Leq><FieldRef Name="Created" /><Value Type="DateTime">2017-04-18</Value></Leq></Where>‘
$spQuery.Query = $camlQuery
$spListItem = $spList.GetItems($spQuery)
$spListItem[0].ID
$spListItem[0].UniqueId
$spListItem[0].Title
Write-Host $spListItem.Count
$spListItem|%{$spList.GetItemById($_.Id).Delete()}
$spList.Update()

[存储记录]SharePoint循环删除任务