Excluding on label in:inbox -label:labelToEclude in setQ (corresponding to Gmail UI)
I am using: implementation("com.google.api-client:google-api-client:2.7.0") implementation("com.google.oauth-client:google-oauth-client-jetty:1.36.0") implementation("com.google.apis:google-api-services-gmail:v1-rev20240520-2.0.0")
val listResponse = gmailService.users().threads().list(meUser) .setQ(query) .setFields("threads(id)") .setMaxResults(10L) .execute()
with query in:inbox -label:test
The end result is to get emails in the inbox, but not with label test. This currently does not work in the UI, there seems to be some special treatment for the in:inbox / label:inbox, because other label:A -label:B is working as expected, giving threads with label A, but not B. So this special behaviour for label:inbox is unexpected.
Right now I have to retrieve all threads and get labels (to get label ids to label name mapping) and then filter on threads. Instead of just directly getting the threads needed.