How to Recover a Deleted OneDrive Site from SharePoint Online
Question details
The user needs to recover the OneDrive site of a deleted and subsequently recreated Microsoft 365 user from SharePoint Online.

- Product
- SharePoint Online / OneDrive
- Device & OS
- not provided
- Scenario
- A Microsoft 365 user was deleted and then recreated with a changed username, causing their original OneDrive site to become inaccessible.
- Observed behavior
- The original OneDrive site has disappeared from SharePoint Online, returning either a 404 error or an Access Denied message, potentially due to retention expiration or a duplicate site ID conflict.
Ensure you have SharePoint Administrator privileges in your Microsoft 365 tenant and have the SharePoint Online Management Shell installed before attempting to run restoration commands.
Verify Site Status and Restore via SharePoint Online PowerShell
Determine if the OneDrive site is still available in the deleted collection and use PowerShell commands to restore it before the retention period expires.
The response of the old OneDrive URL helps determine the site's status. A 404 Not Found error usually means the site is deleted, while an Access Denied message suggests the site still exists but lacks proper permissions. As long as the OneDrive site is within the retention period (default 30 days), an administrator can recover it.
Navigate to the user's old OneDrive URL in your web browser. Note whether the page returns a 404 error or an Access Denied message to assess its current state.
Open the SharePoint Online Management Shell as an administrator and run the command `Connect-SPOService -Url https://<yourtenant>-admin.sharepoint.com` to connect to your admin center.
Run the command `Get-SPODeletedSite -IncludePersonalSite | Where-Object { $_.Url -like '*personal*' }` to view the list of deleted OneDrive sites and find the missing URL.
Execute the command `Restore-SPODeletedSite -Identity <OneDriveURL>` to recover the deleted user's OneDrive site from the recycle bin.
Run `Set-SPOUser -Site <OneDriveURL> -LoginName <NewAdminUPN> -IsSiteCollectionAdmin $true` to grant access to the newly recreated user or an administrator.

Looking for a Simpler Cloud Office Solution? Try WPS Office
Managing Microsoft 365 administration, SharePoint permissions, and PowerShell commands can be complex and time-consuming. WPS Office offers a free, lightweight, and highly compatible alternative with built-in cloud services, making file management, collaboration, and recovery seamless and straightforward.
- 1. Download WPS Office: Visit the official WPS website and download the free WPS Office installation package for your operating system.
- 2. Install and create an account: Run the installer, follow the on-screen prompts, and sign in to activate your free WPS Cloud storage space.
- 3. Open your documents securely: Launch WPS Office to easily open, edit, and back up your Microsoft Office files securely to the cloud.

Frequently Asked Questions
How long is a deleted OneDrive site kept in Microsoft 365?
By default, when a Microsoft 365 user is deleted, their OneDrive site is retained for 30 days in the recycle bin before it is permanently deleted. Administrators can change this retention period up to 3650 days in the SharePoint admin center.
What causes a 404 error versus an Access Denied error on a OneDrive URL?
A 404 Not Found error indicates that the OneDrive site has been deleted or purged from the active tenant. An Access Denied error usually means the site is still active or in a restorable state, but your current account does not have the necessary permissions to view it.
Can I recover a OneDrive site without using PowerShell?
If the user was deleted recently (within 30 days), restoring the user account directly in the Microsoft 365 Admin Center will automatically restore their OneDrive. However, if the user was recreated and caused a URL mismatch or duplicate site ID, PowerShell is required to map or restore the specific site.
Can I assign ownership of a restored OneDrive site to a new user?
Yes, once the site is successfully restored using PowerShell, a SharePoint administrator can use the `Set-SPOUser` cmdlet to assign Site Collection Administrator permissions to a newly recreated user or a different admin account.




