【问题标题】:how to switch off conversation view in App Script如何在 App Script 中关闭对话视图
【发布时间】:2018-09-30 22:15:39
【问题描述】:

我正在编写一个脚本,该脚本从收到的分配给特定标签的电子邮件地址中提取 Gmail 附件,并将附件移动到 Google Drive 中的特定文件夹中,现在我的问题是当我收到来自同一发件人的同一电子邮件主题的电子邮件时保存在不同标签中的脚本忽略将附件移动到 Google Drive 中的不同文件夹,因为 Google 将同一主题的电子邮件分组为对话,但是当我关闭 Gmail 中的对话视图时,脚本可以工作。是否有解决此问题的方法或 Google App Script 中的功能来打开和关闭对话视图?示例:

   { // subject1 >>
    "filter": "from:no-reply@test1.com", // Email to extract attachments from 
    "folder": "folder1/Belasting/20000/Berario/", // Folder to send attachments to in Gdrive
     "filenameTo": "'%s' ~ yyyy MM dd", // format of renaming files if {RenameFile is set to true}
     "Renamefile": false, // Turn renaming of files on and off
     "globalFilter": "has:attachment in:label1-coj-berario -in:trash -in:drafts -in:spam", // Labels to fetch attachments from in Gmail
     "markUsRead": false,
    "newerThan": "1m", // how far back to fetch attachments
    "archive": true // Turn achiving on and off
     },

    { // subject1
     "filter": "from:no-reply@test1.com", // Email to extract attachments from 
    "folder": "folder1/Belasting/20000/Tan", // Folder to send attachments to in Gdrive
    "filenameTo": "'%s' ~ yyyy MM dd", // format of renaming files if {RenameFile is set to true}
   "Renamefile": false, // Turn renaming of files on and off
    "globalFilter": "has:attachment in:label2-coj-berenice-tan -in:trash -in:drafts -in:spam", // Labels to fetch attachments from in Gmail
   "markUsRead": false,
    "newerThan": "1m", // how far back to fetch attachments
    "archive": true // Turn achiving on and off
    },

电子邮件具有相同的主题不同的标签和要保存的文件夹,但由于电子邮件具有相同的主题并在对话视图中分组,脚本会提取附件并将​​它们保存在同一文件夹中

【问题讨论】:

  • 您有没有找到在 Apps 脚本中切换对话视图的方法?我也想这样做。

标签: google-apps-script gmail gmail-api


【解决方案1】:

您可以从 gmail 应用设置切换对话。点击查看所有设置。 向下滚动,你会发现这个。 对话视图: (设置是否将同一主题的电子邮件分组在一起)
对话视图 会话视图关闭

只需点击关闭对话视图。

【讨论】:

    【解决方案2】:

    我不知道是否可以从 Apps 脚本中切换对话视图(甚至查看用户的对话视图设置)。在撰写本文时,一般来说,Gmail V1 API 似乎不支持与 gmail.com UI 设置进行交互。从问题中不清楚您可以在脚本中访问哪些信息,但您可以使用单个电子邮件的 messageIdthreadId 属性来解决您的目标。正如您所指出的,Gmail 会自动将电子邮件分组到共享相同threadId 的线程中,但个别电子邮件也有一个唯一的messageId。通过比较具有相同主题的电子邮件的messageId,您应该能够区分它们。

    【讨论】:

      猜你喜欢
      • 2018-04-08
      • 2014-05-06
      • 1970-01-01
      • 1970-01-01
      • 2011-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多