Looking for syntax to query: gis.users.search(query="???")

1313
3
04-07-2020 11:16 PM
by Anonymous User
Not applicable

I am trying to search users by email. So gis.users.search(query='first.last@joe.com') works but the email query is case sensitive. So if they their user.email is First.Last@joe.com I do not find the user. Users are both internal to the organization and external.  Can anybody link a syntax guide or provide me with a recommendation.  Thank you.

0 Kudos
3 Replies
JoshuaBixby
MVP Esteemed Contributor

The UserManager - arcgis.gis module — arcgis 1.8.0 documentation documentation points users to the REST API documentation for search parameters:

Note

A few things that will be helpful to know.

  1. The query syntax has quite a few features that can’t be adequately described here. The query syntax is available in ArcGIS help. A short version of that URL is http://bitly.com/1fJ8q31.

  2. Searching without specifying a query parameter returns a list of all users in your organization.

  3. Most of the time when searching users you want to search within your organization in ArcGIS Online or within your Portal. As a convenience, the method automatically appends your organization id to the query by default. If you don’t want the API to append to your query set outside_org to True. If you use this feature with an OR clause such as field=x or field=y you should put this into parenthesis when using outside_org.

For your specific situation, there is no case-insensitive or wildcard search for AGOL/Portal user e-mails.  There have been, and still are, enhancement requests for such functionality, but Esri hasn't acted on them in years.  Honestly, I don't think they ever will, especially for wildcards. 

Although you cannot do a case-insensitive user e-mail search directly, there is an interesting behavior where you can query on the user part of an e-mail address and a case insensitive search is done.  In your example, searching on "First.Last" would return first.last@joe.com; however, it might return additional results as well so you might need additional filtering. 

You can also search on company e-mail, "joe.com", since that is likely to be all lowercase, and then use Python to search for the user within that company.

by Anonymous User
Not applicable

Thank you for the response Joshua.  I had started off using First.Last but thought it would be best to use the full email. I will go back and use my first code. It is unfortunate that the additional functionality isn't being added.  

I have read that note and found that 1 is very little help. The link doesn't work and finding ArcGIS help is not so easy to find...  Do you have a link for syntax query features?

1. The query syntax has quite a few features that can’t be adequately described here. The query syntax is available in ArcGIS help. A short version of that URL is http://bitly.com/1fJ8q31.

 

 

0 Kudos
JoshuaBixby
MVP Esteemed Contributor
0 Kudos