Translate

Thursday, June 2, 2022

Restore OneDrive Site

Once a user leaves the organization and the user Id is deactivated, the user OneDrive site is deleted after the retention days are over. However, after the OneDrive site is deleted, the site remains in the recycle bin for 93 days. This recycle bin isn't accessible (as of June 1st 2022) from the UI. So, Microsoft has provided PowerShell capability to restore the OneDrive site.

  1. Connect-SPOService - Connect to the SharePoint Online service using your admin center URL
  2. Get-SPODeletedSite -Identity {OneDrive Site URL} - This should list the number of days left before the site is permanently deleted. If this doesn't return anything, that means the site isn't deleted.
  3. Restore-SPODeletedSite -Identity {OneDrive Site URL} - The cmdlet will restore the Deleted OneDrive site
  4.  Set-SPOUser -Site {OneDrive Site URL} -LoginName {UPN of the user needs access} -IsSiteCollectionAdmin $True - This is optional. In case you/someone needs admin access to the OneDrive site
  5. Disconnect-SPOService - to close the open connection