Wednesday 4 December 2013

Delete all SharePoint List Item using Powershell in SharePoint

Share it Please
Sytax:-

$SITEURL = "http://serverurl"

$site = new-object Microsoft.SharePoint.SPSite ( $SITEURL )
$web = $site.OpenWeb()
"Web is : " + $web.Title

$oList = $web.Lists["LIST NAME"];

"List is :" + $oList.Title + " with item count " + $oList.ItemCount

$collListItems = $oList.Items;
$count = $collListItems.Count - 1

for($intIndex = $count; $intIndex -gt -1; $intIndex--)
{
        "Deleting record: " + $intIndex
        $collListItems.Delete($intIndex);
}

No comments:

Post a Comment

Followers

Follow The Author