Goal: get an array of threads from gmail that fulfills filter criteria:
thread must have label "new" that is nested under label "Status" thread must not have label "open" that is nested under label "Status"
Failed attempt: var threads_new = GmailApp.search('label:Status-new -label:Status-open'); gives me the same as: var threads_new = GmailApp.search('label:Status-new) So "Status/open" was not sorted out.
New approach: I want to first load all mail threads with label "new" as array "threads_new" and then create a new array "threads_closed" that does not contain label "open":
var threads_closed = threads_new.filter(function(thread) { return thread.getLabels.indexOf("Status/open")!=-1});
I run into: TypeError: thread_new.getLabels.indexOf is not a function
Any Idea? Thanks a lot