The following Gmail / Inbox By Gmail search returns everything in my inbox that is pinned.
in:inbox label:pinned
And this returns all unpinned inbox messages.
in:inbox -label:pinned
side note: Even though messages are "pinned" in Inbox By Gmail, and not Gmail, the search still works as expected in both web apps.
The following Google Apps Script logs only pinned emails.
function GetUnpinnedEmails() {
var threads = GmailApp.search('in:inbox label:pinned');
for (var i = 0; i < threads.length; i++) {
message = threads[i].getMessages()[0];
subject = message.getSubject();
Logger.log(subject)
}
}
However, the following Google Apps Script logs all inbox emails including pinned messages.
function GetUnpinnedEmails() {
var threads = GmailApp.search('in:inbox -label:pinned');
for (var i = 0; i < threads.length; i++) {
message = threads[i].getMessages()[0];
subject = message.getSubject();
Logger.log(subject)
}
}
GmailApp.search('in:inbox NOT label:pinned')
also returns all inbox messages.
I think this is a bug but I thought I'd see if I'm missing something. Thanks.
No longer an problem. Google fixed the issue.
https://issuetracker.google.com/issues/64715312