Emptying SharePoint Recycle Bin

Welcome Forums General PowerShell Q&A Emptying SharePoint Recycle Bin

This topic contains 1 reply, has 2 voices, and was last updated by

7 months ago.

  • Author
  • #108868

    Points: 0
    Rank: Member

    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: http://www.sharepointdiary.com/2013/02/search-recycle-bin-sprecyclebinquery.html

    Can someone help me with this?

    #Get the Site collection
    $site = new-object Microsoft.SharePoint.SPSite("http://sharepoint.company.com")
    #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 "------------------------------------")
  • #108889

    Points: 1,564
    Helping Hand
    Rank: Community Hero

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

The topic ‘Emptying SharePoint Recycle Bin’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort