LoginSignup
0
1

More than 1 year has passed since last update.

40 代おっさん GASのGmailThreadクラスについて学ぶ

Posted at

本記事ついて

本記事は プログラミング初学者の私が学習していく中でわからない単語や概要をなるべくわかりやすい様にまとめたものです。
もし誤りなどありましたらコメントにてお知らせいただけるとありがたいです。

GmailThreadクラス

GmailThreadクラスとは
スレッドを扱う機能を提供するクラス

*GmailThreadクラスの図は、参考資料の本を見ていただくか、ネットで調べください。

ちなみにこちらで書いてありました。
https://for-dummies.net/gas-noobs/gas-japanese-reference-for-gmail/

スレッドを操作する

GmailThreadクラスを使って、重要マークを付与、ゴミ箱に移動するなど操作することができる。

お試し

function tosiki() {
  const query = 'subject:スレッドとメッセージを確認する';
  const threads = GmailApp.search(query, 0, 1);

  threads[0].markImportant();
  threads[0].markUnread();
  threads[0].moveToInbox();
}

検索などで配列として収得したスレッドの集合に対して操作する場合

function tosiki() {
  const query = 'subject:スレッドとメッセージを確認する';
  const threads = GmailApp.search(query, 0, 1);

  GmailApp.markThreadsImportant(threads);
  GmailApp.markThreadsUnimportant(threads);
  GmailApp.moveThreadsToInbox(threads);
}

参考資料

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1