Skip to content

Commit a9eefe3

Browse files
committed
Handle paging edge case.
1 parent 7741a21 commit a9eefe3

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/Custom/ListCmdlet.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ public void InitializePaging(ref global::System.Management.Automation.Invocation
9494
}
9595

9696
int currentPageSize = invocationInfo.BoundParameters.ContainsKey("PageSize") ? PageSize : DefaultPageSize;
97+
if (invocationInfo.BoundParameters.ContainsKey("Top") && limit < currentPageSize)
98+
{
99+
currentPageSize = limit;
100+
}
97101
// Explicitly set `-Top` parameter to currentPageSize in order for the generated cmdlets to construct a URL with a `$top` query parameter.
98102
invocationInfo.BoundParameters["Top"] = currentPageSize;
99103
top = currentPageSize;

0 commit comments

Comments
 (0)