Delete all items in SharePoint List using PowerShell
While testing SharePoint solution with SPLists I often need empty list. I'd like to have analog for "Truncate" in SQL, but there's nothing for SharePoint.
So I wrote a short PowerShell script for deleting all items in SharePoint List. Here it is
# "Enter the site URL instead http://serverurl"
$SITEURL = "http://serverurl"
$site = new-object Microsoft.SharePoint.SPSite ( $SITEURL )
$web = $site.OpenWeb()
"Web is : " + $web.Title
# Enter name of the List below insted of LIST NAME
$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);
}
Using C# deleting like this - it must be from last to first element (Correct way to delete all SPListItems)
Custom Label with multiple styles in TextField of Fluent UI
First impressions after using the new SPFX 1.22.2 with Heft
Changing the Runtime Environment for an Azure App Service