1

Restore deleted items from recycle bin using Item GUID and export all deleted items in CSV file using Powershell

$SiteURL=""
$ItemName="Test.xlsx" 

$site = Get-SPSite $SiteURL
$RecycleBin = $site.RecycleBin

$Item = $RecycleBin | Where{$_.Title -eq $ItemName}

if($Item -ne $null)
{
 $Item.Restore()
 Write-Host "Item Restored from Recycle Bin!" -f DarkGreen
}
else
{
  Write-Host "No Item Found with the given name!" -ForegroundColor RED
}
  • 1
    So, what have you tried? – Christoffer Mar 6 '18 at 13:21
  • Please add this script and information in the question – Arsalan Adam Khatri Mar 6 '18 at 13:59
0

to Export the recycle bin information of a SharePoint site into Excel

Add-PsSnapin Microsoft.SharePoint.Powershell -ea 0

# please specify the desired exportpath
$exportFile = "e:\temp\recycle.csv"
$siteUrl = "yourSiteCollectionUrl"

("Web", "ItemState", "Type", "Title", "Directory", "Name", "AuthorName", 
"DeletedByName", "DeletedDate") -join ";" | Out-File -FilePath $exportFile

Write-Host "Data export from recycle bin of site $($siteUrl)"
$site = Get-SPSite $siteUrl

$site.RecycleBin | ForEach-Object {
    ($_.ItemState, $_.Web, $_.ItemType, $_.Title, $_.DirName, $_.LeafName, 
 $_.AuthorName, $_.DeletedByName, $_.DeletedDate) -join ";" | Out-File -
 FilePath $exportFile -Append
}

$site.Dispose()
Write-Host "Operation completed."


the source reference and more detail here

to restore a file from recycle bin by GUID

$site = Get-SPSite http://sp/sites/sitename
$site.RecycleBin.Restore("file GUID")


hope this answers your question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.