Hi @Daniel Chee
For RecycleBinItem properties, there is only author properties. There is no such properties such as created and modified date. The items in Recycle Bin don't contain the column in their lists before they are deleted. I feel regretful to inform you that it turns out to be a by-design one. The items in Recycle Bin comes from different lists and they all have different columns. If they all have their custom columns in Recycle Bin. The list will run into a mess. So RecycleBinItem only have following properties in the document
https://learn.microsoft.com/en-us/previous-versions/office/sharepoint-csom/ee536442(v=office.15)
Since we are unable to use custom id, I will recommend you to use the guid in RecycleBinItem
Get-PnPRecycleBinItem | Select Title, ID, ItemType, Size, ItemState, DirName, DeletedByName, DeletedDateLocalFormatted | Format-table -AutoSize
You can also recover multiple items refer to following script
#Get All Items deleted from a specific path or library - sort by most recently deleted
$DeletedItems = Get-PnPRecycleBinItem | Where { $_.DirName -like "$DirPath*"} | Sort-Object -Property DeletedDate -Descending
#Restore all deleted items from the given path to its original location
ForEach($Item in $DeletedItems)
{
#Get the Original location of the deleted file
$OriginalLocation = "/"+$Item.DirName+"/"+$Item.LeafName
If($Item.ItemType -eq "File")
{
$OriginalItem = Get-PnPFile -Url $OriginalLocation -AsListItem -ErrorAction SilentlyContinue
}
Else #Folder
{
$OriginalItem = Get-PnPFolder -Url $OriginalLocation -ErrorAction SilentlyContinue
}
#Check if the item exists in the original location
If($OriginalItem -eq $null)
{
#Restore the item
$Item | Restore-PnpRecycleBinItem -Force
Write-Host "Item '$($Item.LeafName)' restored Successfully!" -f Green
}
Else
{
Write-Host "There is another file with the same name.. Skipping $($Item.LeafName)" -f Yellow
}
}
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.