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

Add -Includes parameter to Get-PnPListItem #3270

Merged
merged 3 commits into from
Aug 6, 2023

Conversation

jackpoz
Copy link
Contributor

@jackpoz jackpoz commented Jul 14, 2023

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

None

What is in this Pull Request ?

Add -Includes parameter to Get-PnPListItem preserving the current Get-PnPListItem loaded properties.
This is needed in cases where additional ListItem properties need to be loaded, including them in the same ClientContext.ExecuteQueryRetry() that Get-PnPListItem uses instead of triggering additional queries for each list item with Get-PnPProperty. A common scenario is to check which files/folders have unique permissions in a big library (50'000+ items), requiring to load HasUniqueRoleAssignments property.

Different parameter combinations have been tested before and after this PR, with and without specifying -Includes. Please find in the zip below how to reproduce scripts and the output of Get-PnPListItem
Tests.zip

A summary of test cases is:

Get-PnPListItem -List $list -Id $id
Get-PnPListItem -List $list -Id $id -Fields $fields
Get-PnPListItem -List $list -Id $id -IncludeContentType
Get-PnPListItem -List $list -Id $id -IncludeContentType -Fields $fields
Get-PnPListItem -List $list -UniqueId $uniqueId
Get-PnPListItem -List $list -UniqueId $uniqueId -Fields $fields
Get-PnPListItem -List $list -UniqueId $uniqueId -IncludeContentType
Get-PnPListItem -List $list -UniqueId $uniqueId -IncludeContentType -Fields $fields
Get-PnPListItem -List $list
Get-PnPListItem -List $list -Fields $fields
Get-PnPListItem -List $list -IncludeContentType
Get-PnPListItem -List $list -IncludeContentType -Fields $fields

The same cases have been tested with -Includes "HasUniqueRoleAssignments" .

Summary

copilot:summary

Details

copilot:walkthrough

jackpoz and others added 3 commits July 14, 2023 11:41
Add -Includes parameter to Get-PnPListItem preserving the current Get-PnPListItem loaded properties
@KoenZomers
Copy link
Collaborator

Nice one @jackpoz, thanks!

@KoenZomers KoenZomers merged commit b5da970 into pnp:dev Aug 6, 2023
1 check passed
@jackpoz jackpoz deleted the features/getlistitem-includes branch August 10, 2024 13:49
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.

2 participants