How to restore deleted OneDrive site from the bin in Office365

A customer has requested whether it was possible to restore a OneDrive site that had been deleted when the user’s account was marked for deletion in AD. After a bit of research, I was able to restore the site back and retrieved the files (luckily it was deleted less than 30 days ago).

First, there is a setting in OneDrive admin centre ( -> Storage tab, where you could specify the retention period of a OneDrive site, once its associated user account is deleted. The default is set to 30 days but this can be changed to 3,650 days (10 years).


Now, to retrieve the deleted site from the bin, follow the following steps:

Connect-SPOService -Url <>

Make sure you use the admin credential.

  • To determine whether the site is available, we run the Get-SPODeletedSite command to check:

          Get-SPODeletedSite -IncludeOnlyPersonalSite | FT url

This will retrieve all the deleted OneDrive sites in the bin (if they haven’t been removed in the cloud).

  • Once you have identified the site, run the Restore-SPODeletedSite command to get the site back:

         Restore-SPODeletedSite -Identiy <>

  • Now, we also need to set the owner of the site to yourself so you could see the files:

         Set-SPOUser -Site <> -LoginName <your username> -IsSiteCollectionAdmin $true

Categories: O365, Sharepoint Online