Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting the optional query parameters for the Users.messages.list

Tags:

c#

.net

gmail-api

I'm trying to do an advanced search using the Gmail API, but I can't figure out how to set the parameters of the query. I want to do a search with the query is:chat, so all the returned messages will be only chat messages.

In the documentation's example, they use a method called setQ("query"), but that only works in Java. Does someone knows how to set this parameter in C#?

Edit: In Java, would be like this: service.users().messages().list("me").setQ("is:chat").execute();

like image 810
Daniel Marín Avatar asked Jul 31 '14 12:07

Daniel Marín


1 Answers

Ok, I feel kind of dumb right now, the answer was very simple. It just requires to separate the call in three lines:

ListRequest request = service.Users.Messages.List("me");
request.Q = "is:chat";
ListMessagesResponse response = await request.Execute();
like image 134
Daniel Marín Avatar answered Sep 27 '22 23:09

Daniel Marín