0
有其他人發現,先進的Gmail服務呼叫Gmail.Users.Messages.remove(我ID) - 未發現錯誤
`Gmail.Users.Messages.remove(me, id)`
現在是給錯誤?有沒有人有修復?
我有一個可靠的腳本,每隔幾個小時就刪除垃圾郵件和垃圾郵件。自從17年2月21日左右以來,即使傳遞了有效的線程ID,它也會給出錯誤「未找到」。
這是腳本。我添加了一些日誌消息
function deleteForever() {
var threads = GmailApp.getSpamThreads(0, 100);
var me = Session.getActiveUser().getEmail();
for (var i = threads.length -1; i >=0; i--) {
var thisid=threads[i].getId();
Logger.log("Removing thread " +i + ' of ' + threads.length + " from Spam with ID = " + thisid);
try {
var thisthread=GmailApp.getThreadById(thisid);
Logger.log("Found the thread.");
Gmail.Users.Messages.remove(me, thisid);
}catch(err) {
Logger.log("Error " + err.message);
};
}
Logger.log("Finished removing " + threads.length + " threads from Spam.");
var threads = GmailApp.getTrashThreads(0, 100);
for (var i = threads.length -1; i >=0; i--) {
Logger.log("Removing thread " +i + ' of ' + threads.length + " from Trash");
try {
Gmail.Users.Messages.remove(me, threads[i].getId());
} catch(err) {
Logger.log("Error " + err.message);
};
}
Logger.log("Finished removing " + threads.length + " threads from Trash.");
}
現在它只是給出一個未找到錯誤。
[17-02-25 11:45:49:790 GMT] Removing thread 17 of 18 from Spam with ID = 15a6fe6c1a86a020
[17-02-25 11:45:49:829 GMT] Found the thread.
[17-02-25 11:45:49:959 GMT] Error Not Found
[17-02-25 11:45:49:959 GMT] Removing thread 16 of 18 from Spam with ID = 15a6fe6c168f4a03
[17-02-25 11:45:50:000 GMT] Found the thread.
[17-02-25 11:45:50:129 GMT] Error Not Found
[17-02-25 11:45:50:130 GMT] Removing thread 15 of 18 from Spam with ID = 15a6fed29f6650b3
[17-02-25 11:45:50:165 GMT] Found the thread.
[17-02-25 11:45:50:294 GMT] Error Not Found
.....
`
請注意,在嘗試執行刪除操作之前,thisid肯定設置爲有效的ID。
是,就是這樣。據推測,在線程中只有1條消息的情況下,這種方法奏效了,垃圾郵件或垃圾包含一個線程的情況並不是很多,但那些線程沒有被刪除。 –
如果問題得到解決,請選擇最佳答案並關閉此問題。 –