r/GoogleAppsScript • • 16m ago

Question Errors from long standing and working script(s)...

So I've got a function, long standing which works|worked fine until lately and I am getting this:

GoogleJsonResponseException: API call to gmail.users.messages.delete failed with error: Requested entity was not found.

Code:

function deleteForever(userId, labelName) {

var threads = GmailApp.search("in:trash");

for (var i = 0; i < threads.length; i++) {

Gmail.Users.Messages.delete('[me]', threads[i].getId());

}

}

[me] is clearly a placeholder for the gmail address..

I've also tried it with .remove too... Same error.

I've tried using delete v. remove, and even this:

function DeleteMail() {
  var threads = GmailApp.search('in:trash');
  for (var i = 0; i < threads.length; i++) {
    var thisId = threads[i].getId();
    Gmail.Users.Messages.remove('[me]', thisId);
  }
}

Gets:

GoogleJsonResponseException: API call to gmail.users.messages.delete failed with error: Requested entity was not found.

DeleteMail

@

YES there is message in the trash.. lots of them actually... so??? shrug...

I ain't no ECMAScript guy, nor the variant(s) of it that google etc. adulterate ...

The only thing I can think is there is TOO MUCH TRASH? Variable overflow? Well then say that! Urrghhh..

So...?? Ideas??? Thanks!

1 Upvotes

0 comments sorted by