SharePoint Online – Restore All files Deleted by Specific User.

It can happen with the OneDrive Sync Client that users accidentally delete the entire SharePoint library full of documents because they do not understand how it works and think the files might be located on their computer or they just accidentally clicked “Delete”.

It is always recommended to have a third-party backup solution on your Microsoft 365 services. OneDrive, SharePoint, Exchange, etc..

If your users have just deleted the entire document library from the SharePoint site, it is a really time-consuming task to manually restore the files via the recycle bin because you can only select 100 files at a time.

Let’s start by connecting to the site via SharePoint Online PowerShell.

You can run the following command to get a quick number of how many files are deleted by the specific user.

We now have the total amount of deleted files by the specific user on the specific SharePoint site.

Let’s get an overview of what data has been deleted by the specific user and exactly how many files are resting in the recycle bin.

Put the CSV file in any of your favorite CSV file readers.
The output should give you everything you need regarding filename, date and who deleted the files.

In most cases restoring everything the specific user has deleted won’t do too much damage, but if you don’t want to restore everything the user has deleted, you can specify the command to only get files from a specific date.

Here is how to restore every file deleted by a specific user.

If you want to receive a live countdown of how many files are left you can run the following via PowerShell to keep track of the files.

If you have any questions / feedback or would like to correct me on any of the stuff above, please use the comment section or contact me directly using the blue button in the bottom right corner.

Leave a Comment