-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGmail-Unimportance.gs
20 lines (16 loc) · 1.01 KB
/
Gmail-Unimportance.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function GmailUnimportance() {
var searches = [ // SEARCH MATCHES
'is:important AND category:promotions', // Promotions category
'is:important AND category:updates', // Updates category
'is:important AND in:spam', // In Spam
'is:important AND in:trash', // In Trash
]; //
var threads = []; // WORK WITH GROUPS OF 250 ITEMS
for (var i = 0; i < searches.length; i++) { //
var tmp_threads = GmailApp.search(searches[i], 0, 249); //
var threads = threads.concat(tmp_threads); //
} //
for (var i = 0; i < threads.length; i++) { // MARK UNIMPORTANT
threads[i].markUnimportant(); //
} //
}