googleworkspace / googleworkspace/apps-script-samples
getLicenseAssignments pageToken returns null value
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.2k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
Expected Behavior
getLicenseAssignments should return all the users in the specified domain. PageToken should be populated to allow calling more than 500 results.
url: https://github.com/googleworkspace/apps-script-samples/blob/master/advanced/adminSDK.gs
Actual Behavior
getLicenseAssignments only returns the first page and the PageToken value is null. Also, the while(pageToken) is on the wrong line. It is currently on line 212 and should be on line 220.
Steps to Reproduce the Problem
- Call getLicenseAssignments and request 500 as the max result. Assuming there are more than 500 users, you should get a list of 500 users.
- Change maxResults to 1 and you should only get one result and pagetoken is null.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open advanced/adminSDK.gs and inspect getLicenseAssignments, especially the pagination logic around lines 212 and 220. Reproduce the issue with maxResults set to 1 and verify that results beyond the first page can be retrieved and that pageToken is populated when more users remain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100