Skip to content

Add -Includes parameter to Get-PnPListItem#3270

Merged
KoenZomers merged 3 commits intopnp:devfrom
jackpoz:features/getlistitem-includes
Aug 6, 2023
Merged

Add -Includes parameter to Get-PnPListItem#3270
KoenZomers merged 3 commits intopnp:devfrom
jackpoz:features/getlistitem-includes

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
@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