Search code examples
gmailgmail-api

Any way to do EXACTLY the same Gmail search via APIs as you can via filters/UI? (the normal APIs I found don't behave the same)


So I discovered that the queries specified in GmailApp.search and Gmail.Users.Messages.list don't behave the same way as in the UI or as in Gmail filters.

Specifically, the API doesn't seem to engage in word stemming. So searching for something like subject:job also matches jobs in the UI and in filters, but not in the API.

Is there a workaround for this so I can get exactly the same behavior?
(I also tried IMAP, but that didn't work either.)


Solution

  • The optional q parameter that you can send in the body of a request using Users.messages: list supports the same search string query format as the Gmail web UI, so it looks like this is behaviour that shouldn't be happening.

    I've submitted this as an issue to Goggle Issue Tracker, which you can follow here and give a star to keep up-to-date with updates.