In Office 365 Sites / SharePoint Online, deleted objects are supposed to hang around for 90 days.
While playing around with SharePoint Online I deleted a site collection, then went and had a look in the SharePoint Online admin portal. I was a little surprised to see that it showed that it only had 30 days to live – that’s a lot less than the 90 that MS states.
I searched the net, and confirmed, it is in fact supposed to be 90 days.
It turns out that between day 30 and 90, you must use powershell to recover a deleted SharePoint Online/o365 site.
The commands to do this are fairly straightforward:
#connect to SPO Connect-SPOService -url https://tenantname-admin.sharepoint.com -credential email@domain.com #take a look at the Sites in the long term recycle bin: get-SPODeletedSite
Now the above commands will get you connected to SPO, and then show you what sites you have that are deleted.
If you only have one site, you can just pipe the output to Restore-SPODeletedSite
# RESTORE EVERYTHING Get-SPODeletedSite | Restore-SPODeletedSite
What if you only want to restore one site?
Just use “where”
Here’s a full example:
#connect to SPO Connect-SPOService -url https://tenantname-admin.sharepoint.com -credential email@domain.com #take a look at the Sites in the long term recycle bin: get-SPODeletedSite #usepick one URL from above and use it here: Get-SPODeletedSite | Where {$_.url -eq "https://yourURL/sites/yoursite"} | Restore-SPODeletedSite