Closed WJurecki closed 5 years ago
Hey @WJurecki - Great idea! Checking it out!
@WJurecki - Since this is pretty applicable to any of the other List
functions, I POC'd it with Get-GSTeamDrive
and it's working well. I opted for a parameter named Limit
instead of First
, but will add First
as an alias to that parameter where applicable:
Green circled blocks shows the reduction of the page size when the next page is calculated to exceed the desired limit so that only the exact count desired are returned.
Blue circled blocks show the reduction of the page size when the first page is calculated to exceed the desired limit.
@WJurecki - Working well! Using your initial examples, for reference:
Bonus guardrails:
Sneak peak at the changelog so far for 2.28.0 with this request's additions highlighted 😃
Hey @WJurecki - This has been deployed in v2.28.0! Let me know if all is well or if you are seeing any issues!
@scrthq - Looks great. I've tried it a few times and looks to work well. I'll let you know if I run into any problems. Thanks again
Perfect! Thanks, @WJurecki !
When utilizing
Get-GSActivityReport
I would like to be able to limit the result set to a specified limit.While simply using
Get-GSActivityReport | Select-Object -First 50
, for example, would limit the results to 50 items as desired, it requires all of the overhead of returning all results and then only selecting the first 50. By adding a-First
option toGet-GSActivityReport
the code could stop retrieving additional pages of results once the specified number has been received, thus reducing the time to obtain a final result set.If, for example, I only wanted the first 50 objects I would simply use
Get-GSActivityReport -First 50 -PageSize 50
which would return the entire set in one round-trip. If I only wanted to detect if ANY activity had happened I could useGet-GSActivityReport -First 1 -PageSize 1
which would result in one round-trip with the smallest possible result set.