Reputation: 281
Hi all i'm using send To Drive apps script.
Now if a e-mail that i receive contains a image as attachment, that image is stored in the folder that i specified but i can't see the preview as soon as i try to open it.
Instead if i upload manually the image in Google Drive i can see the preview.
I noticed that the urls of the images created from apps script have longer id than of the others image uploaded manually.
Example of image id that i cannot see (created by apps script):
Example of image id that i can see (uploaded manually)
https://docs.google.com/a/xxxx.com/file/d/0B1G2PrcwzsrzMG5kVDZuUGlqRWc/edit
How i can solve this problem modifying the script??
Thank you in advance
var threads = GmailApp.getUserLabelByName(gLabel).getThreads(0, 5);
var folder = DocsList.getFolder(gFolder);
for (var x=0; x<threads.length; x++) {
var messages = threads[x].getMessages();
for (var y=0; y<messages.length; y++) {
var att = messages[y].getAttachments();
for (var z=0; z<att.length; z++) {
try {
Logger.log(att[z].getContentType());
var file = folder.createFile(att[z]);
Utilities.sleep(1000);
}
catch (e) {
GmailApp.sendEmail(
Session.getActiveUser().getUserLoginId(),
"Error: " + e.message
);
}
}
}
GmailApp.getUserLabelByName(gLabel)
.removeFromThread(threads[x]);
}
Upvotes: 0
Views: 783