0

I want to get all the peoples whose PreferredName contains "Tar".

I have written a search query for this search

/_api/search/query?querytext='*'&selectproperties='PreferredName,OriginalPath,WorkEmail,SipAddress,Department,Path,PictureURL,JobTitle,AccountName,BaseOfficeLocation,'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'&refinementfilters='substringof("Tar", PreferredName)'

but it shows an error message "Bad Request" and tells refinementFilter is invalid. what is the error in this query??

1

3 Answers 3

1

You can use it as below:

/_api/search/query?querytext='*'&selectproperties='PreferredName,OriginalPath,WorkEmail,SipAddress,Department,Path,PictureURL,JobTitle,AccountName,BaseOfficeLocation,'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'&refinementfilters='PreferredName:("Tar*")'

looks like substring or contains is not supported in refinement filters

2
0

You can use filter=substringof('Tar', PreferredName) to find names containing the string "Tar".

Your query will be:

/_api/search/query?querytext='*'&selectproperties='PreferredName,OriginalPath,WorkEmail,SipAddress,Department,Path,PictureURL,JobTitle,AccountName,BaseOfficeLocation,'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'&filter='substringof("Tar", PreferredName)'

Read More: Filter Expressions

3
0

You can try using "tar"

/_api/search/query?querytext='*'&selectproperties='PreferredName,OriginalPath,WorkEmail,SipAddress,Department,Path,PictureURL,JobTitle,AccountName,BaseOfficeLocation,'&sourceid='b09a7990-05ea-4af9-81ef-edfab16c4e31'&refinementfilters='PreferredName:("*Tar*")'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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