1

I'm using a custom created google apps script to send out some emails. I have a PDF in my google drive that I am trying to attach to an email but it is not working. I keep on getting the error "Document is missing (perhaps it was deleted?)"

Here is my full code...

    function sendDetails(e) {
var itemURL = 'https://docs.google.com/file/d/0Bw7JWLKeRBKASUFldGM1RTRIaFE/edit';
var docName = DocumentApp.openByUrl(itemURL).getName();
}

Note that the above PDF is a publicly accessible PDF file that anyone can get to. I know it exists but it's not allowing me to access it. All that I am trying to do is take the file and attach it to an email. There is obviously more to my code than the about but I trimmed down just to that to try to narrow the error and no such luck. Any help would be greatly appreciated.

4

1 回答 1

5

DocumentApp 处理 Google Documents - Google 的类似 WordPad 的编辑器。由于有问题的文件是 PDF,因此 DocumentApp 无法使用它。

相反,您应该使用DriveApp。此外,由于没有通过 URL 打开文件的 DriveApp 方法,因此您需要使用DriveApp.getFileById()。(ID"0Bw7JWLKeRBKASUFldGM1RTRIaFE"在您的示例中。)

于 2013-04-15T17:25:53.993 回答