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

Fix exceptions in Restore-PnPRecycleBinItem #4667

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

jackpoz
Copy link
Contributor

@jackpoz jackpoz commented Jan 7, 2025

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

Fixes #4664

What is in this Pull Request ?

Fix some exceptions in Restore-PnPRecycleBinItem :

  • A type conversion error was thrown when passing a System.Guid object as RecycleBinItemPipeBind parameter class didn't have a constructor for System.Guid, only for String.
  • _id field of RecycleBinItemPipeBind is used when fetching the recycle item using PnP.Core but it wasn't initialized when passing a Microsoft.SharePoint.Client.RecycleBinItem object, which is what Get-PnPRecycleBinItem returns .
  • A null exception was thrown when RecycleBinItemPipeBind failed to find the item, now the message "Recycle bin item not found with the ID specified" is displayed instead
    Screenshot 2025-01-07 203231

This is the result with these fixes:

  • Passing to Restore-PnPRecycleBinItem the result of Get-PnPRecycleBinItem
    image
  • Passing to Restore-PnPRecycleBinItem a System.Guid object
    Screenshot 2025-01-07 203515

@KoenZomers
Copy link
Collaborator

Thanks @jackpoz !

@KoenZomers KoenZomers merged commit 452a8d4 into pnp:dev Jan 22, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Restore-PnPRecycleBinItem - Type Conversion Errors
2 participants