18

There are numerous reports of issues with Gmail labels, stars, unreads, message counts, and generally searching or counting combinations of these. Many of these seem to come from a common cause.

I understand that Google has obscurely documented that: despite showing labels as if they belong to the conversation, they actually belong to individual messages. And I understand that new messages appended to an existing conversation do not inherit any of the labels previously used in that conversation.

Two things could solve this, as I see it so far:

  • Make sure new messages in a conversation automatically inherit user labels from the conversation.
  • Work around this so that at least I can review conversations for which search criteria applies to conversations as if they had the labels and stars and unread statuses of their constituent messages.

Main question:

What is a step-by-step workflow that ordinary Gmail users can use to work around this issue? Workflow examples might include, but are not limited to:

  • Per-message or per-conversation handling / command sequences
  • Installation and running of automated maintenance scripts
  • Non-standard (non-intuitive) search queries
  • Daily/Weekly (i.e. periodic) handling or procedures
  • Creative uses of filters
  • Labs features
  • ...

Other information

Easily reproduce the issue yourself

  1. Send a test message to yourself.
  2. Open that new unread conversation that only has one message in it.
  3. Label that conversation with a new label "mylabel". Then go back to inbox.
  4. Search for "is:starred label:mylabel" and verify that nothing shows up because nothing is starred.
  5. Open the test conversation.
  6. Reply to that message and send. Then go back to the inbox.
  7. Open that test conversation and click a star on this second message in the conversation. Then go back to the inbox.
  8. We verify that there is a conversation that has a star and has the label "mylabel".
  9. Search the same search before ("is:starred label:mylabel"). We expect to find the test conversation there because it is both starred and has the "mylabel" label.
  10. BUG: No conversations show up.

But I'm still interested in finding the starred conversations that have that label.

List of documented cases and discussions

2
  • Not a bug. It's finding exactly what you told it to do: There are NO conversations that have a MESSAGE with both Mylabel and a star. Consider it a non-useful feature.... May 7, 2018 at 2:16
  • However your example explained the behaviour I've seen. You get a vote for that. May 7, 2018 at 2:16

2 Answers 2

3

The following work flow helps.

Get into conversation mode if not already there. (General settings)

For each label:

  • Select the label
  • Check the box above the list to select all in the list.
  • Check the link that appears at the top of the list to extend the selection to the rest of the labeled conversations.

At this point you have selected all conversations that have at least one message tagged with this label.

  • Drag the label from the list at left onto the selected conversations.

  • If you selected more than 100 You will be asked to confirm. Do so.

This takes half a minute to a minute per label depending on how many messages you are working with.


Are you done?

Check Go to search slot. search for has:nouserlabels This should NOT show any matching labels. If it does then there is at least one unlabeled message in that conversation.

Downside: Sent messages added to this thread will not inherit the labels.

Second workaround:

Work on your filters. By default filters are ANDed together. However you can do things like

from:[email protected] OR to:[email protected] 

in the has text box. This will label outgoing messages as well as incoming ones.

-1

this bit of app script is what i use now. I run this before a start reviewing emails for each label i want to exclude from my searches.

function gmailfix(){
  var label = GmailApp.getUserLabelByName("FollowUp")
  var threads = {}
  var index = 0
  do{
    threads = GmailApp.search('label:FollowUp newer_than:1w',index,100);
    label.addToThreads(threads)
    index = index+100
  }while(threads.length > 0)
}

GmailApp.getUserLabelByName("FollowUp") fetches the label we are concerned with. The the first argument to the search function works just like the search box in gmail. Because label.addToThreads(threads) can only work on 100 threads a time the search is limited 100 threads starting at thread index with is initially 0 and gets incremented by 100 and the search repeated until no results are found.

label.addToThreads(threads) applies the label to every message in every thread in the array threads.

the reason addToThreads is limited to 100 entries is that is it can be slow. It is likely that unless you are a clean inbox person that the script will time out before getting to all of your emails. which is why the search only goes back one week. Depending on the amount of emails you are dealing with you can kick that back further, or try removing it.

the script could be set to run once a week with a trigger, that will ensure that going forward every email will be caught in case you go on vacation.

https://developers.google.com/apps-script/reference/gmail

https://developers.google.com/apps-script/guides/triggers/installable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.