Author Posts

August 17, 2018 at 3:15 pm

I am trying to move 1st stage recycle bin to second stage recycle bin if item has been deleted by certain user, it is able to search but not move using this source:

Can someone help me with this?



#Get the Site collection

$site = new-object Microsoft.SharePoint.SPSite("")


#Create new object for SPRecycleBinQuery

$query = new-object Microsoft.SharePoint.SPRecycleBinQuery


#$query.ItemState = "FirstStageRecycleBin"

$query.ItemState = "SecondStageRecycleBin"


#How many Rows to be returned

$query.RowLimit = 100


#Call GetRecycleBinItems to Search Inside SharePoint Recycle Bin

$DeletedItemsColl = $site.GetRecycleBinItems($query)


#Filter Result

$Result= $DeletedItemsColl | where  {$_.DeletedByName -match "Drew Brees"}


#Write output

$Result | foreach-object {

(Write-Host "Found Item:" $_.Title)

(write-host "Created by:" $_.AuthorName)

(write-host "Deleted by:" $_.DeletedByName)

(write-host  "Deleted Date:"$_.DeletedDate)

(write-host  "File Size(Bytes):" $_.Size)

(write-host  "Original Location:" $_.DirName)

(write-host "Web:" $_.web.URL)

(Write-Host "------------------------------------")


August 17, 2018 at 4:09 pm

You have to use gist (via github) or the 'pre' tags for posting script in the forum.