I am trying to delete items in a list using CSOM powershell but it doesn't seem to work at all, Here is my code atm which is trying to print out the title of my list items but this isn't working either(not printing out any data). Where am I going wrong?
$web = $ctx.Web
$site = $ctx.Site
$ctx.Load($web)
$list = $web.Lists.GetByTitle("Pages")
write-host $list.ItemCount
Write-Host ("Deleting old result page")
Write-Output("Deleting old result page")
foreach($listItem in $list)
{
$ctx.Load($listItem)
$ctx.ExecuteQuery()
}