Deleted File Recovery

How to Recover a Deleted OneDrive Site from SharePoint Online

Huma Ashraf ChHuma Ashraf Ch Oct 26, 2026 869 views

Question details

The user needs to recover the OneDrive site of a deleted and subsequently recreated Microsoft 365 user from SharePoint Online.

How to Recover a Deleted OneDrive Site 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.
Before you start

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.

Solution 1Recommended

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.

1
Check the old OneDrive URL

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.

2
Connect to SharePoint Online

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.

3
Locate the deleted site

Run the command `Get-SPODeletedSite -IncludePersonalSite | Where-Object { $_.Url -like '*personal*' }` to view the list of deleted OneDrive sites and find the missing URL.

4
Restore the site

Execute the command `Restore-SPODeletedSite -Identity <OneDriveURL>` to recover the deleted user's OneDrive site from the recycle bin.

5
Assign ownership

Run `Set-SPOUser -Site <OneDriveURL> -LoginName <NewAdminUPN> -IsSiteCollectionAdmin $true` to grant access to the newly recreated user or an administrator.

Verify Site Status and Restore via SharePoint Online PowerShell
Retention Period Warning: If the site does not appear in the deleted-site collection when using PowerShell, the retention period has likely expired, and the site data cannot be recovered.
Free Microsoft Office alternative

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. 1. Download WPS Office: Visit the official WPS website and download the free WPS Office installation package for your operating system.
  2. 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. 3. Open your documents securely: Launch WPS Office to easily open, edit, and back up your Microsoft Office files securely to the cloud.
Fully compatible with Microsoft Office formats (Word, Excel, PowerPoint).Built-in WPS Cloud for easy auto-saving, secure storage, and effortless file recovery without the need for PowerShell.Lightweight installation and a familiar user interface for immediate productivity.Free to download and use, significantly reducing your software subscription costs.
microsoft office alternative - wps office

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.