jay
jay

Reputation: 1175

QueryOption Search in Graph API for email address

I would like to search in my sent folder for every email that is sent to "[email protected]"

I tried the following

 List<QueryOption> queryOptions = new List<QueryOption> { new QueryOption("$search", "[email protected]") }; 

List<QueryOption> queryOptions = new List<QueryOption> { new QueryOption("$search", "john.smith1%40gmail.com") }; 

 List<QueryOption> queryOptions = new List<QueryOption> { new QueryOption("$search", "to:[email protected]") }; 

List<QueryOption> queryOptions = new List<QueryOption> { new QueryOption("$search", "to:john.smith1%40gmail.com") }; 

  var messages = await client.Users["[email protected]"].Messages.Request(queryOptions ).GetAsync();

none of the above works. It complains of any non alpha character ( it seems it does not accept number, dot, ":" )

Any advices? Thanks.

Upvotes: 0

Views: 2618

Answers (1)

Shiva Keshav Varma
Shiva Keshav Varma

Reputation: 3575

Use it this way -

List<QueryOption> queryOptions = new List<QueryOption>
{                                                  
    new QueryOption("$search", "%22abcd02%40gmail.com%22") 
}; 

%22 is nothing but the double quotes. We are just concatenating it to work.

Upvotes: 1

Related Questions