Share via


Restoring of bulk items from the Recycle bin - SharePoint Online

Question

Friday, June 21, 2019 2:39 PM

Can we restore a large number of deleted items from the Recycle Bin in SharePoint Online. Is there a custom solution.

This is for both Modern and Classic Team sites?

Thanks!

Mayank

All replies (4)

Friday, June 21, 2019 3:16 PM

Hi Mayankguru,

If you are looking a solution in Powershell, then below article may help you to do bulk restore.

https://www.c-sharpcorner.com/blogs/restore-sharepoint-item-from-recycle-bin-using-powershell

_______________________ 

Thivagar SEGAR
[If this Post helps you, then please don't forget to mark it answer or Vote for this post]


Monday, June 24, 2019 1:53 AM

If you are SharePoint Site administrator, you can recover the Deleted items are retained in recycle bins to its original location, but for SharePoint Online, the retention time is 93 days. It stays there for the remainder of the 93 days, and then is permanently deleted.


Monday, June 24, 2019 3:29 AM | 1 vote

Hi Mayank,

You can restore a large number of deleted items from the Recycle Bin in SharePoint Online by PowerShell.

There is a demo below for your reference.

$SiteUrl = " https://tenant.sharepoint.com/sites/sitename"

$UserName = "[email protected]"

$Password = "password"

$SecurePassword= ConvertTo-SecureString $Password –asplaintext –force

$Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword) 

 $Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl) 

    $Context.Credentials = $Credentials 

    $Site = $Context.Site 

    $RecycleBinItems = $Site.RecycleBin 

    $Context.Load($Site) 

    $Context.Load($RecycleBinItems) 

    $Context.ExecuteQuery() 

    # The above code will help to retrieve all items from the recycle bin on below table format 

    $RecycleBinItems | Select Title, DeletedByEmail, DeletedDate, ItemType, ItemState | Format-Table -AutoSize

               

                Foreach($RecycleBinItem in $RecycleBinItems)

                {

               

                   $itemsre=$RecycleBinItem.Title

                    $RecycleBinItem.Restore() 

                    $Context.ExecuteQuery() 

        Write-Host $itemsre "Restored" -ForegroundColor Yellow 

                 

                }

Best regards,

Sara Fan

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].

SharePoint Server 2019 has been released, you can click

here to download it.
Click

here to learn new features. Visit the dedicated

forum to share, explore and talk to experts about SharePoint Server 2019.


Tuesday, June 25, 2019 8:56 AM

Hi Mayank,

If the reply is helpful to you, you could mark the reply as answer. Thanks for your understanding.

Best regards,

Sara Fan

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].

SharePoint Server 2019 has been released, you can click

here to download it.
Click

here to learn new features. Visit the dedicated

forum to share, explore and talk to experts about SharePoint Server 2019.