title: Get multiple Threads by ThreadID in Google Apps Script's GmailApp Class
body: <p>I have an array of strings where each value represents a Gmail Threadid. This looks something like this:</p>
  
  <pre><code>var threadArray = [threadId1, threadId2, threadId3, threadId4, threadId5];
  </code></pre>
  
  <p>I want to apply a Gmail Label to each of the elements in my array of threadids, but my current approach is not efficient and takes too long to execute. See below:</p>
  
  <pre><code>for (var i = 0; i &lt; threadArray.length; i++)
  {
      thread = getThreadById(threadArray[i]) // this statement takes too long (several seconds) to execute!!
      thread.addLabel(exampleLabel);
  }
  </code></pre>
  
  <p>What's the best approach for applying a Gmail Label to each Gmail Thread in an array of Gmail ThreadIds? </p>
  
  <p>Gmail provides functions like <code>getInboxThreads()</code> which retrieve many threads at once to return GmailThread[] but its unclear to me how I can construct my own GmailThread[] purely based on the threadids, not my entire inbox.</p>
  
  <p>Has anyone else experienced this issue or found a workaround?  I found a similar open issue here: <a href="https://code.google.com/p/google-apps-script-issues/issues/detail?id=2598" rel="nofollow">https://code.google.com/p/google-apps-script-issues/issues/detail?id=2598</a></p>