Restoring deleted OneDrive sites in Office365
Rate this post

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:
Download Sharepoint Management Shell if you haven’t.
Open it, use it to connect to Sharepoint online:

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 -IsSiteCollectionAdmin $true

Happy restoring!

Office 365, SharePoint
, , ,

Leave a Reply

Notify of
Follow Us!

Kloud Solutions Blog - Follow Us!