Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9628

Retrieving labels from the Gmail thread

$
0
0

I'm a beginner in JavaScript and I'm looking to create a script with google script which has the role of retrieving the labels present in my google inbox and compare them with the labels that I defined in filter if this one is in the filters Gmail should not archive it otherwise all other labels Gmail must archive them after two days

I could see in the Gmail API documentation that there is a script that can retrieve the labels in the thread, unfortunately I can't retrieve all the labels present in each message of my thread and the script proposed by google only retrieves the defined labels, I tried with a loop but it didn't give anything I think my loop is wrong.

Here's my script:

function GmailAutomationScript() {  var firstThread = GmailApp.getInboxThreads(0,400);  for (var a = 0; a < firstThread.length; i++)   {    var labels = firstThread[a].getLabels();for (var i = 0; i < labels.length; i++) {  Logger.log(labels[i].getName());}    }}

Viewing all articles
Browse latest Browse all 9628

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>