0

I'm using Google Apps Script and Content Service. I would like to provider users with a way to download an attachment for a given Gmail Message.

The Gmail Attachment objects doesn't expose a download URL like the Site Attachment does so I'm trying to use Content Service to serve the bits for the attachment. Content Service appears to only support text and does not have an API for returning byte[].

Is there a work around?

4

1 回答 1

0

选项 1
您可以使用 Base64 将附件编码为 Base64 Utilities.base64Encode(),然后在客户端对其进行解码。

选项 2
将附件保存到云端硬盘,授予适当的权限并提供下载附件的链接。

顺便说一句,仅当您的附件不是手动访问时,ContentService 才有用,即它们是通过另一个程序访问的。如果您的用户手动调用脚本,他们可能会得到一个链接来下载附件

于 2013-09-22T03:00:22.847 回答