Unfortunately, there’s no equivalent for "Truncate" in SharePoint Lists. It’s not very good. If your list has more than 1000 items and you need to load only new data to list, you need to remove all existing items and to add new ones. This task is easy to code but not very fast to execute.

Earlier I wrote about how to remove SPListItems (correct-way-to-delete-all-splistitems). That solution was for C#, but for PowerShell it’s the same. Now I found some faster way to truncate SPList (remove SPListItems). The code below is for PowerShell, but it can be easily adapted for using in C# application.

Remove-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue 
Add-PSSnapin Microsoft.SharePoint.PowerShell -erroraction SilentlyContinue   

$SiteURL = "http://spdev/dc/" 
$ListName = "payments" 
$ListDescription = "Payments" 
$SPWeb = Get-SPWeb $SiteURL 

$now = Get-Date 

$spList = $SPWeb.Lists[$ListName] 
$now = Get-Date 
Write-Host "Stared at: "  + $now 
foreach($item in $spList.Items) { 
                $deadItem = $spList.GetItemById($item.ID) 
                $deadItem.Delete() 
        } 
$finished = Get-Date

Write-Host "Finished at: "  + $finished

 

This script also displays the time of start and finish of truncating SharePoint List.