Skip to content

[BUG] Get-PnPRecycleBinItem does not return all items #5258

@gaiking-uk

Description

@gaiking-uk

Issue description

  • The Get-PnPRecycleBinItem documentation specifically states that if Get-PnPRecycleBinItem is called without passing either -FirstStage or -SecondStage, the cmdlet will return "All" items in the recycle bin.
  • This is not correct however, in fact the -FirstStage is implied even when not passed explicitly and the only way to get a list of all items in the recycle bin is to run the cmdlet twice (once with -FirstStage and again with -SecondStage) and then merge the result sets together.
  • In essence, Get-PnPRecycleBinItem -FirstStage and Get-PnPRecycleBinItem are identical.

Scenario:

  • There are 3,000 items in the recycle bin overall
  • There are 1,000 items in the first stage recycle bin
  • There are 2,000 items in the second stage recycle bin

Expected behavior

  • Running Get-PnPRecycleBinItem -FirstStage returns the 1,000 items in the first stage recycle bin
  • Running Get-PnPRecycleBinItem -SecondStage returns the 2,000 items in the second stage recycle bin
  • Running Get-PnPRecycleBinItem returns all 3,000 items in the recycle bin, across both the first and second stages

Actual behavior

  • Running Get-PnPRecycleBinItem -FirstStage returns the 1,000 items in the first stage recycle bin
  • Running Get-PnPRecycleBinItem -SecondStage returns the 2,000 items in the second stage recycle bin
  • Running Get-PnPRecycleBinItem also returns the 1,000 items in the first stage recycle bin (only) and does return any items that are in the second stage recycle bin

Steps to reproduce behaviour

  • Replicate the above scenario and tests

What is the version of the Cmdlet module you are running?

  • 3.1.0

Which operating system/environment are you running PnP PowerShell on?

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions