Kashif Nizam Qureshi

Deleting List Items Through PowerShell

Leave a comment

$web = Get-SPWeb http://mthqdmzenq02:5000/sites/ClaimsPortalCopy/SampleOrder
$listName = "ChemicalSampleOrder"
$list = $web.Lists[$listName]
$items = $list.Items 

Write-Host $items.Count
for($i=$items.Count-1;$i -ge 0;$i--  )
{
Write-Host $list.Items[$i].id
$list.Items[$i].Delete()
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s