Share via


SharePoint: Maintenance Page for Deleting and Archiving Items

Introduction

This SharePoint Maintenance Page has the ff. features

  • Check item count for all Lists & Libraries on your SharePoint Site
  • Highlight Lists & Libraries that have reached or about to reach the threshold
  • Delete List Items
  • Archive List Items

The Page uses jQuery and SharePoint REST API. This should work on SharePoint 2013 and Online.

How it works

The source code can be downloaded here.

Running Health Check

Health Check will show all Lists & Libraries on your site with their Item Count.

Any List or Library with items greater than or equal to 4000 will be marked in RED else it will be in GREEN. The default value can be edited on the source code.

Deleting Items

You can delete Items or Documents from the Target List or Library using the Delete Items button. You have the option to provide a custom SharePoint REST API Filter using the Textbox. If Textbox is blank it will get the Top 1000 items by default.

A confirmation will prompt that requires you to type the word "DELETE" to proceed.

Below, I try to delete items from my ErrorLogging List using filter ID eq 0 which will not return any item.

Below, I try to delete items from ErrorLogging List without any filter. It shows the IDs of the Deleted Items. Running Health Check will show that ErrorLogging list is now empty.

Archiving Items

You can Archive Items or Documents from the Target List or Library using the Archive Items button. You have the option to provide a custom SharePoint REST API Filter using the Textbox. If Textbox is blank it will get the Top 1000 items by default. You need to create the Archive List/Library Manually before Archiving. Archive Lists should have the same columns and types from Source. IDs, Created, and Modified dates will not be retained.

A confirmation will prompt that requires you to type the word "ARCHIVE" to proceed.

Below, I try to archive items from my ProcessTasks List using a date filter. This will show you the IDs of the Items move from Source to Target List/Library.
These items will be deleted Source List/Library.

Adding to your SharePoint Page

  1. Download Source Code here.
  2. Create a SharePoint Page (.aspx)
  3. Edit your Page and Click Embed Code
  4. Copy/Paste from the Source Code
  5. Save your Page