I used to have working script applications that deleted old sales letters in my Gmail account.
He used the code
var label = GmailApp.getUserLabelByName("Promotions");
to get the label, and then it repeats through label.getThreads()to decide if each thread was old enough to be deleted.
However, now Google has changed Gmail, therefore it is automatically classified in the section Categoriesin the user interface, and not in the list of labels, so the above text now returns null.
How can I fix my code to get a category Promotions? I tried too Categories/Promotions, but it also appears null.
source
share