The documentation states:
Query string for prefix matching searches. Should be of the form "key":"value" where key can be "email", "firstName" or "lastName".
I've tried:
directory.users().list().setQuery("email:" + email).execute()
directory.users().list().setQuery("\"email\":\"" + email + "\"").execute()
directory.users().list().setQuery("email:\"" + email + "\"").execute()
They all return a 400 : Bad Request response. How do I properly filter on the email address? Thank you!
Currently the list API supports only prefix queries, please refer to the documentation for query parameter here.
Try with query as "email:[email protected]*" -> Note the asterisk at the end.
Here's the way to get a user by email address.
directory.users().get(userKey=email).execute()
Code to search for a user by email address should be something like
directory.users().list(query='email:[email protected]').execute()
but this doesn't work. I suspect a bug in Google's API docs, or possibly in the actual implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With