-label:pinned works in Gmail but not in the Google Apps Script GmailApp.search() function? -
the following gmail / inbox gmail search returns in inbox pinned.
in:inbox label:pinned
and returns unpinned inbox messages.
in:inbox -label:pinned
side note: though messages "pinned" in inbox gmail, , not gmail, search still works expected in both web apps.
the following google apps script logs pinned emails.
function getunpinnedemails() { var threads = gmailapp.search('in:inbox label:pinned'); (var = 0; < threads.length; i++) { message = threads[i].getmessages()[0]; subject = message.getsubject(); logger.log(subject) } } however, following google apps script logs all inbox emails including pinned messages.
function getunpinnedemails() { var threads = gmailapp.search('in:inbox -label:pinned'); (var = 0; < threads.length; i++) { message = threads[i].getmessages()[0]; subject = message.getsubject(); logger.log(subject) } } gmailapp.search('in:inbox not label:pinned') returns inbox messages.
i think bug thought i'd see if i'm missing something. thanks.
based thread, gmailapp.search()should use is:unread / in:inbox , search query parameter label: shouldn't have dash before it.
you can check in page list of accepted search query parameters.
Comments
Post a Comment