Skip to content

Instantly share code, notes, and snippets.

@johnvilsack
Created March 10, 2022 19:04
Show Gist options
  • Save johnvilsack/5e68b76a39e82c85fe0e0f4ac65ff428 to your computer and use it in GitHub Desktop.
Save johnvilsack/5e68b76a39e82c85fe0e0f4ac65ff428 to your computer and use it in GitHub Desktop.
Google-Apps-Script: getThreadsByLabel
function getThreadsByLabel(label) {
const threads = GmailApp.getUserLabelByName(label).getThreads();
var threadList = [];
for (i = 0; i < threads.length; i++) {
threadList.push(threads[i].getId());
}
delete threads;
return threadList;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment