Skip to content

Commit

Permalink
fix pagination for AllTenants queries
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnDuprey committed Jan 27, 2025
1 parent 079df36 commit b8d13a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ function Invoke-ListGraphRequest {
$Results = Get-GraphRequestList @GraphRequestParams
if ($Results.nextLink) {
Write-Host "NextLink: $($Results.nextLink | Select-Object -Last 1)"
$Metadata['nextLink'] = $Results.nextLink | Select-Object -Last 1
if ($Request.Query.TenantFilter -ne 'AllTenants') {
$Metadata['nextLink'] = $Results.nextLink | Select-Object -Last 1
}
#Results is an array of objects, so we need to remove the last object before returning
$Results = $Results | Select-Object -First ($Results.Count - 1)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function Get-GraphRequestList {
TenantFilter = $_.defaultDomainName
Endpoint = $using:Endpoint
Parameters = $using:Parameters
NoPagination = $using:NoPagination.IsPresent
NoPagination = $false
ReverseTenantLookupProperty = $using:ReverseTenantLookupProperty
ReverseTenantLookup = $using:ReverseTenantLookup.IsPresent
NoAuthCheck = $using:NoAuthCheck.IsPresent
Expand Down

0 comments on commit b8d13a2

Please sign in to comment.