there are methods to move a thread to Archive,Inbox,Spam,Trash. However, I would like to move a thread from Inbox to a custom label created by me. Is there a way to achieve this with Google App API ?
Thanks
there are methods to move a thread to Archive,Inbox,Spam,Trash. However, I would like to move a thread from Inbox to a custom label created by me. Is there a way to achieve this with Google App API ?
Thanks
On
let billsLabel = GmailApp.getUserLabelByName("Bills");
if (!billsLabel) {
label = GmailApp.createLabel(billsLabel);
}
thread.addLabel(billsLabel);
thread.moveToArchive();
You can achieve this by first adding a label to the thread. Then Archiving the thread this will move the email thread to the custom label. The first time I tried this I thought it didn't work. But once I refreshed the inbox and the custom label, I could see it worked.
Have you tried the addLabel method?