问题
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