【发布时间】: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