SharePoint Online – Restore All files Deleted by Specific User.

OneDrive Sync users may accidentally delete an entire SharePoint library because they do not understand how it works or accidentally click “Delete” thinking it’s only the data stored on their computer. It is strongly recommended to have a third-party backup solution for your Microsoft 365 services, including OneDrive, SharePoint, and Exchange. If a user has deleted an entire document library from a SharePoint site, manually restoring the files from the recycle bin can be very time-consuming as 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.

1 thought on “SharePoint Online – Restore All files Deleted by Specific User.”

  1. Hi!

    I love your script,

    but I would like to see in all sites not just one specific site.

    We have very many sites so it would take hours to go to each specific site and run the script.

    Is there a way to run it across all sites?

    Thank you in advance!!

    Wesley

    Reply

Leave a Comment