I have had a script running on a daily trigger for several years which manipulates Gmail labels in order to provide snooze functionality. I have not modified the code. As of 01MAY, it has not been working. Specifically, neither deleteLabel() nor createLabel() will work. The rest of the function works (e.g., the emails are moved from the label into the inbox).
One thing which makes me think this is something Google has caused is that the variable "today" label is removed from the individual emails when they are moved to the inbox. This shouldn't happen unless something is occurring within the deleteLabel method.
function UnSnoozeToday() {
GmailApp.createLabel(today); // creates the label in case it doesn't exist
today = GmailApp.getUserLabelByName(today);
var page = null;
while(!page || page.length == 500) {
page = today.getThreads(0,500);
if (page.length > 0) {
GmailApp.moveThreadsToInbox(page);
}
}
today.deleteLabel();
}
GmailApp.createLabel(today);requires a string parameter. What are you actually passing it? - Diego