microsoftgraph / msgraph-sdk-android

Microsoft Graph SDK for Android! https://graph.microsoft.io
Other
51 stars 43 forks source link

Search request #86

Closed ayatm closed 4 years ago

ayatm commented 5 years ago

I am trying to search for emails by sender email address as the following requestOptions.add(new QueryOption("$search=","\"from:ayat@hhhhhh.com\"")); client .getMe() .getMessages() .buildRequest(requestOptions) .get(new ICallback() {....}

but that does not work! Any idea?

Glennmen commented 5 years ago

Not sure if it is the same for emails but for contacts I use this:

final List<Option> options = new LinkedList<Option>();
options.add(new QueryOption("filter", "startswith(displayName,'" + text + "') or startswith(givenName,'" + text + "') or startswith(surname,'" + text + "')"));

I would assume you can do this:

requestOptions.add(new QueryOption("filter","from/emailAddress/address eq 'ayat@hhhhhh.com'"));

Or if you want to keep using the search param maybe this (I haven't tested it myself):

requestOptions.add(new QueryOption("search","from:ayat@hhhhhh.com"));
ayatm commented 5 years ago

Thank you so much, this one requestOptions.add(new QueryOption("filter","from/emailAddress/address eq 'ayat@hhhhhh.com'")); works with me

baywet commented 4 years ago

Hi everyone, Thank you for the contribution, we have moved away from an android specific SDK to a Java SDK and this repo will be archived very soon. If you're still facing the same issue with the Java SDK, feel free to re-open an issue over there. Closing.