Posts

Showing posts from March, 2019

Restoring a lot of files from the Recycle Bin

I had a customer who accidentally synched a (very large) SP Online library and then decided they didn't want the files on their PC anymore...so they deleted them and were shocked to learn that they'd been deleted from SharePoint too! Thanks to PnP Powershell you can use the following to restore a batch of files quickly (and filter). First, you'll want to make sure you only select the files you want to restore.  I used a combination of filtering by the person who deleted the files and the date they were deleted, e.g. Connect-PnPOnline https://yourtenanturl $restoreSet = Get-PnPRecycleBinItem | Where-Object { $_.DeletedByEmail -eq "imsorry@company.com" -and $_.DeletedDate -gt "1/1/2019" } Make sure you have a fairly updated version of the PnP Powershell module as the objects that come back have more properties populated than in older versions so you can do more powerful filtering Next you can restore the files like this: $restoreSet | Rest