GmailApp附件中的DriveApp createFile无法正常工作

时间:2019-01-28 15:15:03

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

第一次发布,请保持温柔。 我正在使用以下代码: https://www.splitbrain.org/blog/2017-01/30-save_gmail_attachments_to_google_drive https://ctrlq.org/code/19053-send-to-google-drive

我正在尝试将PDF附件从Gmail直接保存到Google云端硬盘。尝试将文件保存在下面的代码的最后一行时,我收到无效参数错误。 我有一个循环来遍历消息线程,然后在该循​​环内,这是保存附件的代码:

<td>

任何人都知道我在做什么错,或者下一步该怎么看?

谢谢

1 个答案:

答案 0 :(得分:0)

好的。所以我设法弄清楚了,所以才更新。 显然contentType'pdf'引起了问题。如果我在尝试保存文件之前先进行了att [0] .setContentType('application / pdf')操作,则该代码将按预期工作。