Created
October 17, 2017 10:33
-
-
Save hcon94/2f1faa2b983ce463e03368292dcb808a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gmailAutoarchive() { | |
// Get all the threads that are labelled | |
var labels = GmailApp.getUserLabels(); | |
for (var a = 0; a < labels.length; a++) { | |
var threads = labels[a].getThreads(0, 400); | |
// Archive all the labelled threads | |
for (var i = 0; i < threads.length; i++) { | |
threads[i].moveToArchive(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment