Created
May 26, 2020 00:17
-
-
Save Windos/c0fc6b98c55330767c3de4294f425f50 to your computer and use it in GitHub Desktop.
Deleted a *very* large directory in SharePoint Online? Restore the files en masse with the SPO PnP Module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Needs the SharePoint Online PnP module, install if haven't got it already: | |
# Install-Module SharePointPnPPowerShellOnline | |
$Uri = 'https://tenant.sharepoint.com/sites/Common' | |
Connect-PnPOnline -Url $Uri -UseWebLogin | |
$DeletedAt = (Get-Date -Day 24 -Month 05 -Hour 0 -Minute 0 -Second 0) | |
$DeletedBy = '[email protected]' | |
$DeletedItems = Get-PnPRecycleBinItem | |
$DeletedItems.Where({$_.DeletedByEmail -eq $DeletedBy -and $_.DeletedDate -gt $DeletedAt}) | | |
Restore-PnpRecycleBinItem -Force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment