Restore deleted documents already restored by OneDrive

Imagine the following scenario:

  • A user syncs a SharePoint document library using OneDrive, so that he can have a local copy of the documents. 
  • When he doesn’t need them anymore, he deletes the documents from the machine (which is a sensible approach).
  • OneDrive syncs the changes and deletes the documents in the SharePoint library.
  • User notices that the documents were deleted, opens the recycle bin and restores them.
  • One Drive syncs all the documents back to the SharePoint library and all is good again. NOT!

Even though all your documents are back into the SharePoint document library, they do not contain information about previous versions. This information is recorded against the original list item object. The original documents, containing the version history information are now in the site recycle bin. But, because OneDrive uploaded a new copy of the documents, you are unable to restore the deleted versions. This is because the library already contains a document with the same name.
This is simple to manually resolve if you only have a few documents affected. But what if we are talking about hundreds or thousands? And multiple libraries? Well, in this case, PnP PowerShell to the rescue!

Continue reading “Restore deleted documents already restored by OneDrive”