Skip to content

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

Closed
@joerodgers

Description

@joerodgers

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions