Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Get-PnPRecycleBinItem - Doesn't return all items #3884

Closed
1 of 6 tasks
robertcaretta opened this issue Apr 10, 2024 · 2 comments
Closed
1 of 6 tasks

[BUG] Get-PnPRecycleBinItem - Doesn't return all items #3884

robertcaretta opened this issue Apr 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@robertcaretta
Copy link

robertcaretta commented Apr 10, 2024

Reporting an Issue or Missing Feature

Get-PnPRecycleBinItem
This command does NOT return all items from First and Second stage recycle bin. Tried with and without the -RowLimit and there was no difference. Tested with 2.4.0

Expected behavior

Get-PnPRecycleBinItem returns all items from BOTH First and Second stage recycle bin.

Actual behavior

Get-PnPRecycleBinItem only returns items from First stage recycle bin.

Also please update your documentation here for "Example 1" as it is not accurate.
https://pnp.github.io/powershell/cmdlets/Get-PnPRecycleBinItem.html

Steps to reproduce behavior

$recycleBinItemsAll = Get-PnpRecycleBinItem
$recycleBinItemsAll.Count

$recycleBinItemsFirst = Get-PnpRecycleBinItem -FirstStage
$recycleBinItemsFirst.Count

$recycleBinItemsSecond = Get-PnpRecycleBinItem -SecondStage
$recycleBinItemsSecond.Count

Work-around

$recycleBinItemsFirst = Get-PnpRecycleBinItem -FirstStage
$recycleBinItemsFirst.Count

$recycleBinItemsSecond = Get-PnpRecycleBinItem -SecondStage
$recycleBinItemsSecond.Count

$recycleBinItems = $recycleBinItemsFirst + $recycleBinItemsSecond
$recycleBinItems.Count

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

2.4.0

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

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify
@robertcaretta robertcaretta added the bug Something isn't working label Apr 10, 2024
@robertcaretta robertcaretta changed the title [BUG] Get-PnPRecycleBinItem - Doesn [BUG] Get-PnPRecycleBinItem - Doesn't return all items Apr 10, 2024
@AndersRask
Copy link

Basically the script just calls CSOM Method Site.GetRecycleBinItems() with itemState None if you do not specify any state, so maybe behaviour of that "black box" has changed.

So you are right that the documentation for Example 1 should say "First recycle bin" but the functionality is "per design" as it is out of our hands.

Your solution is the correct way to do it if you need both!

https://learn.microsoft.com/en-us/dotnet/api/microsoft.sharepoint.client.site.getrecyclebinitems?view=sharepoint-csom

@gautamdsheth
Copy link
Collaborator

As @AndersRask mentioned above, looks like the default CSOM behavior has changed, would suggest you to keep using the same workaround as mentioned.

Afraid we can't do anything here. Closing it as by design

@gautamdsheth gautamdsheth closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants