How do I search for the emails that belong only to a specified label, and do not belong to any other labels.
You can search for emails that belong to a specific label using the
syntax, and you can exclude messages from a specific label using the
So what you want can be accomplished using a combination of these both. You have to compose a search string containing a "-label:mylabel" for all the labels that you have defined, except for the one you are looking for, like this:
Not the world's best way but, use the built in labels to your advantage. This assumes you don't care about labels that GMail applies, like Social, Updates, Promotions, or Forums. These labels are not considered USER LABELS (My example user label: Foo)