Forum Discussion

Ben Dyke's avatar
Ben Dyke
Brass Contributor
Jul 06, 2018

Automate restoration of files from a SharePoint recycle bin

We have started using Microsoft Teams across the organisation and migrating files from the local file server in to Teams document libraries. Users have been shown how to sync Team channels and Document libraries in file explorer with OneDrive to maintain a connection with the old way of accessing files, and also to overcome some of the limitations of Teams (working with non Office files; not seeing thumbnails of photos etc). 

Often users will sync with a channel only and then later on return to SharePoint and sync with the root folder (which I'm presuming updates when a new Teams channel is created) and are then left with both the individual channel and the root folder that contains all the channels as subfolders. They therefore often want to remove the link in File Explorer to the individual channel and be left with the root folder.

Somehow in trying to do this yesterday an employee deleted 60,000 files in 7700 subfolders from a SharePoint site. The files exist in the sites recycle bin but the GUI is not designed to manipulate such volumes (there is no select all, restore all function). Selecting 100 files at a time is pretty time consuming: I've looked for some PowerShell and found this:

https://gallery.technet.microsoft.com/office/Restore-all-filesitemslists-800ba49a#content

But I'm not proficient enough in PS to know how to execute that script correctly on our Sharepoint Online. Is there anyone that can help with this process or suggest other solutions. Hopefully this could lead to helping others in the same situation in future!

4 Replies

  • I would highly recommend you contact Microsoft and get a support ticket here. Files restore would be a great option but it's not implemented in SharePoint online yet. This is one reason I do not tell people and wont' allow syncing on large document libraries because it's very easy for someone to delete a folder thinking they are getting rid of the sync when all those changes actually sync up. It's possible Microsoft has a powershell you can run that preforms the same restore function that files restore can.
    • Ben Dyke's avatar
      Ben Dyke
      Brass Contributor
      Thanks Christopher for the response. I logged the problem with Microsoft from the start but their initial advice was just to use the GUI to restore items. Eventually I persuaded the support that this was not only impractical (100 files per restore operation x 6,000) but also not working (for every 100 I try and restore, around 80 fail with various errors most notably timeout ones). I'm awaiting contact now from the back end team. In the meantime the department affected are unable to work with their SharePoint libraries, and it could be a week before Microsoft restore the whole library, if they even offer to do that...
      • Deleted's avatar
        Deleted
        Bummer. This is a fear of mine and considering turning off sync client for Sharepoint sites until they release files restore for Sharepoint.

Resources