Saturday, May 21, 2016

PowerShell Script to delete all items from SharePoint List

Hi All,

Here is a simple PowerShell command to delete/remove all Items from SharePoint list

#Do not write below line if using SharePoint Power Shell window.
Add-PSSnapin Microsoft.SharePoint.Powershell  

$SITEURL = "Your SharePoint site url"

$site = new-object Microsoft.SharePoint.SPSite ( $SITEURL )
$web = $site.OpenWeb()

$oList = $web.Lists["List Title"];

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

for($intIndex = $count; $intIndex -gt -1; $intIndex--)

Thank you for reading.

No comments:

Post a Comment

SharePoint Deployment Error : The specified path, file name, or both are too long.

Hi, Sometimes we get surprised with below error while deploying wsp file... Solution : To overcome with this issue, we just ne...