Searching for Messages

You can search or filter files using the messages.list and threads.list methods. These methods accept the q parameter which supports the same advanced search syntax as the Gmail web-interface. This means you can use search queries to filter messages by properties such as the sender, date, or label to name a few possibilities. For example, the following query retrieves all messages sent by the user between Jan 1, 2014 and Jan 30, 2014:

GET"in:sent after:2014/01/01 before:2014/01/30"

In addition to search queries, you can also filter messages and threads by label with the labelIds parameter. This allows you to search for messages and threads with the specified system or user labels applied. For more information, see the messages.list or threads.list method reference.

Send feedback about...

Need help? Visit our support page.