Anthony
Anthony

Reputation: 11

Users.messages list capping at number less than maxResults

I'm currently using the Gmail API to list messages including a certain string. With maxResults set at any number (ex. 9000, 8000, 9999) the API caps the list at 511 when this number should be ~800 for my search.

For example, when searching for all emails including the string "A" and maxResults = 9999, it lists only 511 instances.

Is there a problem with the API listing more than 511 items? Has anyone had a similar problem? Thank you!

Upvotes: 1

Views: 125

Answers (1)

MαπμQμαπkγVπ.0
MαπμQμαπkγVπ.0

Reputation: 6739

You are performing Users.messages: list and your maxResults was set to a desired number more than what was fetched.

Try the Try It in the Gmail API using your live data. If it returns with the same value as what was fetched by your code, then there's no problem neither with the API nor your code. It could be that you are missing something like using the nextPageToken. Because I'm sure all your message was fetched and it's just not displayed in a single page.

enter image description here

See also this SO post for reference.

Upvotes: 0

Related Questions