It is usually a Monday. Someone selected a folder in File Explorer, thought they were tidying up a synced copy, and pressed Delete. Now a whole department's library is empty, the recycle bin shows 4,000 items, and the site recycle bin will let you tick 100 of them per page.
This post is the whole route: what the browser can do, the PowerShell that restores exactly what one person deleted, why that script sometimes restores nothing at all, and where a tool is worth it.
First, stop the bleeding
- If the deletion came through the OneDrive sync client, ask the user to pause syncing on that machine before you restore anything. Otherwise the client can helpfully delete the restored files again.
- Note the time. Everything you restore will be filtered by who and when, so "Monday between 09:10 and 09:20" is the most useful thing you can write down.
- Do not empty anything. Deleted items are kept for 93 days across both recycle bins. You have time; you do not have unlimited retries.
What the browser can do
Settings gear → Site contents → Recycle bin. Sort by Deleted so the incident sits at the top, tick the box in the header, click Restore. That restores the page you are looking at, which is 100 items. Scroll, the next 100 load, repeat.
For 300 items that is fine. For 4,000 it is forty rounds of tick, restore, wait, scroll, and the list re-sorts under you while other people's deletions land in between. Most admins give up around round six and go looking for PowerShell.
Two things worth knowing before you leave the browser:
- Restoring a folder does not always bring its contents back. If the folder and its files were deleted in the same operation they usually come back together. If the files were deleted first (a sync client does this) and the folder later, restoring only the folder recreates the path and leaves it empty. Restore the files, or restore both.
- Items you cannot see may still exist. A normal user sees only their own deletions. A site collection administrator sees everyone's. If the person restoring is not an admin, half the incident is invisible.
The PowerShell that does it properly
You need PnP PowerShell and a site collection admin account. The idea is simple: list every recycle bin item, keep the ones deleted by that person in that window, restore those.
Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/Finance -Interactive
$who = 'p.jansen@contoso.com'
$from = Get-Date '2026-06-22 09:00'
$to = Get-Date '2026-06-22 09:30'
Get-PnPRecycleBinItem -RowLimit 50000 |
Where-Object { $_.DeletedByEmail -eq $who -and $_.DeletedDate -ge $from -and $_.DeletedDate -le $to } |
Restore-PnPRecycleBinItem -Force
That is the 80% version. The checks that stop it restoring the wrong thing — showing you the list first, skipping files it should not touch, and confirming afterwards — are the part we built the tool for.
Why the script "works but restores nothing"
This is the question that comes up again and again on Microsoft Q&A: the script runs clean, no errors, and nothing comes back. Three causes cover almost every case.
- You are connected to the wrong site. Recycle bins are per site collection. If the files lived in a subsite or a different site than the URL you connected to, the query returns items from the wrong bin and the filter matches nothing. Check
Get-PnPSitebefore you trust a zero. - The items are in the second-stage bin. When a user (or a script) deletes from the site recycle bin, items move to the site collection recycle bin.
Get-PnPRecycleBinItemreturns both stages by default, but if you added-FirstStagewhile experimenting you will only ever see half. Use-SecondStageto check. - Time zones.
DeletedDatecomes back in UTC. A "09:10 Monday" incident in Amsterdam is 07:10 UTC. Widen the window, or convert.
A fourth, rarer one: the account you connected with is a site owner but not a site collection admin, so it only sees its own deletions. The count will be small and wrong instead of zero.
When PowerShell is the wrong tool
- The person doing the restore is a site owner, not an IT admin, and cannot install modules.
- It happened across several sites and you would have to re-run the script per site.
- You need to see what will be restored before it happens, in a form someone else can approve.
- It is the third time this month.
That is the point where a recycle bin tool earns its price: search by name, date range, or who deleted it, see the matching list, restore it as one job. Undelete365 does exactly that inside the SharePoint page, with no PowerShell and no permissions beyond what the user already has, and it never contains a permanent-delete code path.
Afterwards
- Turn on Restore this library awareness: it can roll the whole library back 30 days, but it also undoes everyone else's work since then. It is the right tool for ransomware, the wrong one for "one user deleted one folder".
- Check the sync client set-up. Most "deleted the whole library" incidents start with a user who synced an entire library instead of adding a shortcut to OneDrive.
- Write down the 93-day date. If anything is still missing after this round, you have until then.