QueryOption Search in Graph API for email address

守給你的承諾、 提交于 2021-01-01 13:51:14

问题


I would like to search in my sent folder for every email that is sent to "john.smith1@gmail.com"

I tried the following

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

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

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

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

  var messages = await client.Users["myuser@mydomain.com"].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.


回答1:


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.



来源:https://stackoverflow.com/questions/64528984/queryoption-search-in-graph-api-for-email-address

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!