Guide: How to Restore Deleted Sharepoint Site Collection

How to Restore Deleted SharePoint Site Collection (Guide)

Last Updated on November 16, 2023

Have you accidentally deleted a SharePoint site collection?

Well, there’s a likely chance, depending on when the site was deleted, that the site collection is completely intact and recoverable.

In this quick guide, I want to show you how to easily restore a deleted SharePoint site collection in two easy-to-follow methods.

Let’s get started.

What happens when you delete a site collection in SharePoint?

The good news here is that you can still recover a deleted site collection. The bad news is that there is a time limit.

Specifically:

  • Team sites associated with a group are recoverable within 30 days after it was deleted.
  • For sites not associated with a Microsoft 365 group, you have 93 days.

When you recover a site collection, the actual restoration time depends on how large the site is and when it was deleted.

The larger the site and the longer the time has passed since it was deleted, the longer it takes for the actual restoration to finish.

Note: For more information about the recycle bins in SharePoint, check out this article: SharePoint Recycle Bin: Everything You Need to Know.

Sign up for exclusive updates, tips, and strategies

    How to restore a deleted site in SharePoint

    There are two methods you can use:

    Method #1: SharePoint Admin Center

    For the first one, you need to get to the SharePoint admin center first:

    • Click the app launcher inside any Microsoft 365 portal
    • Hit the admin button
    Click on the admin app under the app launcher panel

    On the next page:

    • Expand the option for admin centers
    • Click the SharePoint option
    Find SharePoint under the admin centers group

    Once you’re in the SharePoint admin center:

    • Go to the deleted sites page
    • Click the site you want to restore
    • Hit the restore button from the command bar
    Deleted sites: Restore button

    The system will then confirm to you the restoration of the site along with its assets.

    Confirm your decision by clicking the restore button from the dialogue box.

    Related: How to Restore a SharePoint Page (Undoing Changes Guide)

    Method #2: PowerShell

    This other method is effective if you know the site that was accidentally deleted.

    Simply use the code below (credits to Salaudeen Rajack):

    #Config Variables
    $TenantURL = "https://tenant.sharepoint.com"
    $DeletedSiteURL ="https://tenant.sharepoint.com/sites/nameofdeletedsite"
     
    #Connect to PnP Online
    Connect-PnPOnline -Url $TenantURL -Credentials (Get-Credential)
      
    #Get Deleted Site from Recycle Bin
    $DeletedSite = Get-PnPTenantRecycleBinItem | Where {$_.URL -eq $DeletedSiteURL}
     
    If($DeletedSite)
    {
        #restore site collection sharepoint online powershell
        Restore-PnPTenantRecycleBinItem -Url $DeletedSiteURL -Force -ErrorAction Stop
        Write-Host -f Green "Site Collection '$DeletedSiteURL' Restored Successfully!"
    }
    Else
    {
        Write-host -f Yellow "Could not Find Deleted site:"$DeletedSiteURL
    }
    

    This is a more advanced method though. There is also another code where you can sniff out all the deleted sites:

    #Get All Deleted Sites
    Get-SPODeletedSite

    Now, unless you use PowerShell regularly, chances are, you’re better off using the first method I described earlier.

    Note: For more information on deleting sites, check out this guide: How to Delete a SharePoint Site.

    Do you have any questions about restoring a deleted site? Let me know your thoughts below.

    For business inquiries, send me a message through the contact form here and I’ll get back to you asap.

    About Ryan Clark

    As the Modern Workplace Architect at Mr. SharePoint, I help companies of all sizes better leverage Modern Workplace and Digital Process Automation investments. I am also a Microsoft Most Valuable Professional (MVP) for SharePoint and Microsoft 365.

    Subscribe
    Notify of
    guest
    0 Comments
    Oldest
    Newest Most Voted
    Inline Feedbacks
    View all comments
    0
    Would love your thoughts, please comment.x
    ()
    x
    Scroll to Top