title: GmailApp - Add label to specific message, not the thread
body: <p>I'm building a script to automatically move my emails from one label to the next on a day by day basis (so that a message that is stored labelled "5 days" will automatically be labelled "4 days" tomorrow then "3 days" the day after that, and so on).</p>
  
  <p>The problem is that it applies the label to the entire thread, not just the message - which is problematic if you have Conversation View turned off and the various emails seperated under different labels.</p>
  
  <p>Here is my script (which has a daily trigger):</p>
  
  <pre><code>function moveUp(previousLabel, newLabel) {
    var threads = GmailApp.getUserLabelByName(previousLabel).getThreads()
    var numThreads = threads.length
    if (numThreads&gt;0) {
      for(var i = 0; i &lt; numThreads; i++) {
  
        if(GmailApp.getUserLabelByName(previousLabel).getThreads().length&gt;0) {
          var lastThread = GmailApp.getUserLabelByName(previousLabel).getThreads()[0]
          GmailApp.getUserLabelByName(newLabel).addToThread(lastThread.markUnread());
          GmailApp.getUserLabelByName(previousLabel).removeFromThread(lastThread)
          Utilities.sleep(200)
        } else {
          {break;}
        }
      }
    }
  }
  
  function myFunction() {
    var threads = GmailApp.getUserLabelByName("-To Do/1 Day").getThreads()
    var numThreads = threads.length
    if (numThreads&gt;0) {
      for(var i = 0; i &lt; numThreads; i++) {
  
        if(GmailApp.getUserLabelByName("-To Do/1 Day").getThreads().length&gt;0) {
          var lastThread = GmailApp.getUserLabelByName("-To Do/1 Day").getThreads()[0]
          lastThread.moveToInbox().markUnread();
          GmailApp.getUserLabelByName("-To Do/1 Day").removeFromThread(lastThread)
          Utilities.sleep(200)
        } else {
          {break;}
        }
      }
    }
      moveUp("-To Do/2 Days", "-To Do/1 Day")
      moveUp("-To Do/3 Days", "-To Do/2 Days")
      moveUp("-To Do/4 Days", "-To Do/3 Days")
      moveUp("-To Do/5 Days", "-To Do/4 Days")
  }
  </code></pre>
  
  <p>So does anyone know how to only apply the labels to specific messages? Or a workaround to achieve that same result?</p>
  
  <p>Thanks</p>