1

I have a calendar on a Sharepoint site that is broken. In the list's settings window, it says "5125 items (list view threshold is 5000)." When I try to delete old events(from 3 years ago) the count exhibits inconsistent behavior: sometimes the number of items goes down and sometimes it goes up(!). Incidentally when the number goes up, the deleted items don't show up in the recycling bin. Any suggestions how to fix/bring the number below 5000 would be appreciated.

1

You may need to delete items via PowerShell. If you've got access to the Online PowerShell app you could so something similar to the following:

$web = Get-SPWeb <Url-To-Your-Calendars-parent-(sub)site>
$calendar = $web.lists["MyCalendar"]
$calendar.items | 
    Where-Object Created -lt ([datetime]::Today.AddYears(-3)) | 
    ForEach-Object {
        $_.delete()
    }

Note: This is a rough script, I haven't tested, but it's mostly correct. You may want to replace the Delete with something to test if it works... ie Write-Host ($_.Created) will output all the dates of the items returned so you can make sure you've got the right items returned.

You can also use $_.recycle() to put into the recycle bin if you want to not permanently delete all the 3+ year old items.

  • Sorry, KGlasier. I probably did not make it clear: I don't have problem deleting 3 year old items through Sharpoint interface. The problem I'm facing is that when I delete them, the item count does not go down. How do I fix that? – Michael Feb 8 at 23:14
  • @Michael Can you validate that they actually are gone, somehow? You might need to wait for a cleanup job that might run overnight. You said that they don’t always go to the recycle bin- this implies to me that they’re not actually being deleted if they sometimes go to the bin and other times don’t. Never hurts to try a programable method either, just to check. – KGlasier Feb 8 at 23:50
  • Thanks KGlasier. The problem is how do I validate that they actually are gone? – Michael Feb 19 at 23:00
  • KGlasier. The other question is what cleanup job that might run overnight you are talking about: the Recycle bin cleanup job or something else? – Michael Feb 19 at 23:03
0

Another strategy you can try if the option is available, connect the sharepoint calendar to Outlook. Once it is connected you can use Outlook to go to previous months/years and select more than one events and delete.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.