How can I filter multiple columns in REST API using Name/Username when running GET request to UserInformationList?

Here is my Query:

 var getPeoplePickerSuggestion = function(searchKey) {
        var userSearchSuggestionEndpoint = "/_vti_bin/ListData.svc/UserInformationList?$select=Id,Name,UserName,WorkEmail&$filter=substringof('" + searchKey + "',Name)";
        return baseSvc.getRequest(userSearchSuggestionEndpoint);

Please see the below example, you can use the "and" operator, to meet multiple conditions,

  http://{server_name}/_vti_bin/listdata.svc/UserInformationList?$filter=((ContentType eq 'Person') 
  and (substringof(Name,'{query}')))&$orderby=Name

Also, shared by Atish, on the following page, it shows you multiple other operators, you can use in your filter, such as,

You may notice that I have used a query operator like ‘eq’ in above URL. Now let’s see what are the other query operators available, for strings, numeric, and datetimes.

enter image description here

  • Keep in mind you need to escape ' like: substringof(Name,'Bob's Burger') -> substringof(Name,'Bob''s Burger') – Alex Pedersen Jun 24 '16 at 14:48

i ended up with query below, works fine for me now, and i can search on LoginName, Title, or Email.

`var userSearchSuggestionEndpoint = "/_api/web/SiteUsers?$filter=(substringof('" + searchKey + "',LoginName) or substringof('" + searchKey + "',Title) or substringof('" + searchKey + "',Email))";
        return baseSvc.getRequest(userSearchSuggestionEndpoint);`

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.