How to restore deleted Onedrive if same url dublicat exist?

Tetiana Patuk 0 Reputation points
2025-12-13T00:54:30.0233333+00:00

The user went on maternity leave, her O365 license was revoked, and her old OneDrive was deleted. Then she returned from maternity leave, a new O365 license was assigned to her, and a new OneDrive was automatically created with the same url-address. Now we can't restore her old OneDrive, which still has all the documents.

Please help me restore the old OneDrive. beacose is exist two Onedrive (new active and old deleted) with same url-address. The command Restore-SPODeletedSite and Remove-SPODeletedSite don`t work by SiteID.

Microsoft 365 and Office | OneDrive | For business | Windows
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Q&A Assist
    2025-12-13T00:54:43.29+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    To restore the old OneDrive when a new OneDrive with the same URL has been created, you will need to follow these steps:

    1. Check if the old OneDrive is available for restoration: Use PowerShell to check if the deleted OneDrive exists. Run the following command:
         Get-SPODeletedSite -IncludeOnlyPersonalSite | FT url
      
      This will list all deleted personal sites, and you can check if the old OneDrive is listed.
    2. Restore the old OneDrive: If the old OneDrive appears in the results, you can restore it using the following command:
         Restore-SPODeletedSite -Identity <URL>
      
      Replace <URL> with the URL of the old OneDrive.
    3. Assign an administrator: After restoring, you may need to assign an administrator to the restored OneDrive to access the data:
         Set-SPOUser -Site <URL> -LoginName <UPNofDesiredAdmin> -IsSiteCollectionAdmin $True
      
      Again, replace <URL> with the URL of the restored OneDrive and <UPNofDesiredAdmin> with the user principal name of the desired admin.
    4. Handling conflicts: If the commands Restore-SPODeletedSite and Remove-SPODeletedSite do not work due to the existence of the new OneDrive, you may need to consider renaming or removing the new OneDrive if it is not needed, as having two OneDrive sites with the same URL can create conflicts.
    5. Permanently delete the new OneDrive (if necessary): If you decide to delete the new OneDrive, use the following commands:
         Remove-SPOSite -Identity <URL>
         Remove-SPODeletedSite -Identity <URL>
      
      Be cautious, as this action is irreversible.

    By following these steps, you should be able to restore the old OneDrive and access the documents that were previously stored there.


    References:


  2. Vivian-HT 9,165 Reputation points Microsoft External Staff Moderator
    2025-12-13T02:58:13.3333333+00:00

    Dear @Tetiana Patuk,

    Thank you for posting your question in the Microsoft Q&A forum.

    Only account deletion triggers the OneDrive cleanup/retention process; simply revoking the license does not. In many maternity‑leave workflows, admins also delete the Entra ID account, which starts the OneDrive deletion/retention timer.

    When the user later returns with the same UPN, OneDrive auto‑provisions a new personal site at the same URL, creating a URL conflict with the deleted site in the recycle bin. If that URL is already occupied by the newly provisioned OneDrive, the restore fails with a conflict, even when you specify the SiteId.

    In this case, I strongly recommend contacting Microsoft Support for resolution. Since these OneDrive share the same personal site URL. This is not something that can be fully resolved through standard PowerShell commands because the restore process requires backend intervention when a duplicate URL exists.

    Additionally, before contacting support, it’s best practice to back up any files from the new OneDrive to a temporary location (such as a SharePoint library or another OneDrive) to prevent data loss during the restore process.

    Admin can create a support ticket in the Microsoft 365 Admin Center. Please follow the Microsoft guide here: Get support for Microsoft 365 for business

    • Go to the admin center at https://admin.cloud.microsoft. If you get a message that says you don't have permission to access this page or perform this action, you aren't an admin. For more information, see Who has admin permissions in my business?.
    • On the bottom right side of the page, select Help & support.
    • Type a question or keyword into the text box. If you get a drop-down list, select the one closest to your question, or continue typing your question, then press Enter.
    • If the results don't help, at the bottom, select Contact Support.
    • Enter a description of your issue, confirm your contact number and email address, select your preferred contact method, and then select Contact me. The expected wait time is indicated in the Contact support pane.

    Please understand that as forum moderators, our primary goal is to provide helpful guidance and support through general troubleshooting steps. While we don’t have access to internal systems or administrative tools required to resolve account-specific or backend issues, we truly appreciate your understanding of these limitations. We genuinely hope the information we share helps guide you in the right direction, and we're always here to assist as much as we can within our scope.  

    I hope this information is helpful. If I misunderstand anything, please feel free to reach out.

    Thank you for your patience and your understanding. If you have any questions, please feel free to reach out.

    I'm looking forward for your reply.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".   

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. Tetiana Patuk 0 Reputation points
    2025-12-13T04:45:10.4633333+00:00

    The workaround is this:

    1.Permanently Remove new active Onedrive

    This operation is very risky because we are deleting by URL, not SiteID, so we cannot be sure that we are deleting the new Onedrive and not the old one.

    But, testing has shown that it is the new OneDrive that will be removed.

    Remove-SPOSite -Identity  https://<tenant>-my.sharepoint.com/personal/new

    Remove-SPODeletedSite -Identity https://<tenant>-my.sharepoint.com/personal/new

    1. Then restore the old Onedrive

    Restore-SPODeletedSite -Identity https://<tenant>-my.sharepoint.com/personal/old

    3.We can add OneDrive access rights to the user, although they are retained.

    Set-SPOUser -Site https://<tenant>-my.sharepoint.com/personal/old  -LoginName <UPN> -IsSiteCollectionAdmin $True

    4.And with the next command we link this Onedrive to the user profile.

    Request-SPOPersonalSite -UserEmails <UPN>

    It's a shame Microsoft doesn't have an article describing a solution for situations like this.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.