Hi @Capt America,
First, make sure your OneDrive has retention policies enabled. If you're unsure, you can contact your Purview administrator to confirm.
Second, open OneDrive Preservation Hold Library:
- Go to your OneDrive settings.
- Click on "Return to classic OneDrive" at the bottom left.
- Click on the settings gear icon again and select "Site Contents".
- You should see the Preservation Hold Library listed there.
You can select the files you want to restore and click Copy to button
to copy the files to the location you want to restore.
Or you can use PnP PowerShell to restore the files:
This site where OneDrive save Preservation Hold Library in is similar to the SharePoint site and we can try to recover the files using the command of the SharePoint. Just need to replace it with OneDrive site url.
# Define Parameters
$SiteURL = "https://contoso-my.sharepoint.com/personal/username_contoso_onmicrosoft_com/"
$ListName= "Preservation Hold Library"
$User = "username@contoso.onmicrosoft.com"
# Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -UseWebLogin
# Get deleted Items that match conditions
$DeletedItems = Get-PnPListItem -List $ListName -PageSize 2000 | Where {$_.FieldValues.Modified_x0020_By -like $User} | Sort-Object $_.FieldValues.PreservationDatePreserved -Descending
#Iterate through each item in the preservation hold library and restore to original location
ForEach($Item in $DeletedItems) {
Try {
$OriginalURL = $Item.FieldValues.PreservationOriginalURL
Write-host -f Yellow "Copying item:"$OriginalURL
$SourceUrl = $Item.FieldValues.FileRef
#Check if the File exists Already
$FileExists = Get-PnPFile -Url $OriginalURL -ErrorAction SilentlyContinue
If($FileExists)
{
Write-host -f Yellow "`tFile Already Exists!"
}
Else
{
#Copy the file to its original location
Copy-PnPFile -SourceUrl $SourceUrl -TargetUrl $OriginalURL -Force -ErrorAction Stop
Write-host -f Green "`tFile Restored:" $OriginalURL
}
}
Catch {
Write-host "Error: $($_.Exception.Message)" -foregroundcolor Red
}
}
Reference: SharePoint Online: How to Recover Deleted Files from Preservation Hold Library?
Note: Microsoft is providing this information as a convenience to you. The sites are not controlled by Microsoft. Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. Please make sure that you completely understand the risk before retrieving any suggestions from the above link.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.