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-PnPListItem is not honoring the RowLimit element in a CAML query. #2785

Closed
1 of 6 tasks
joerodgers opened this issue Feb 6, 2023 · 0 comments · Fixed by #2804
Closed
1 of 6 tasks

[BUG] Get-PnPListItem is not honoring the RowLimit element in a CAML query. #2785

joerodgers opened this issue Feb 6, 2023 · 0 comments · Fixed by #2804
Labels
bug Something isn't working

Comments

@joerodgers
Copy link

Reporting an Issue or Missing Feature

Get-PnPListItem is not honoring the RowLimit element in a CAML query. I the example below, instead of returning 5 items, it returns all 400+ items in the list. A Fiddler trace shows it's just paging the results 5 items at a time, rather than stopping after the first batch of 5 items.

$query = "
    <View Scope='RecursiveAll'>
        <Query>
            <Where>
                <Eq>
                    <FieldRef Name='SiteStatus'/>
                    <Value Type='Text'>Read-Only</Value>
                </Eq>
            </Where>
        </Query>
        <RowLimit>5</RowLimit>
        <ViewFields>
            <FieldRef Name='SiteURL' />
            <FieldRef Name='SiteStatus' />
        </ViewFields>
        <RowLimit>5</RowLimit>
    </View>" 
    
$items = Get-PnPListItem -List "Sites" -Query $query
$items.Count # return all 436 items in the list

Expected behavior

$items.Count should only return 5 items.

Actual behavior

$items.Count return 436 items.

Steps to reproduce behavior

See above

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

1.11.0

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

  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify
@joerodgers joerodgers added the bug Something isn't working label Feb 6, 2023
gautamdsheth added a commit to gautamdsheth/powershell that referenced this issue Feb 11, 2023
KoenZomers added a commit that referenced this issue Feb 15, 2023
Fix #2785 : issue with RowLimit not being respected when specified from CAML query
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
1 participant