문제

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??

도움이 되었습니까?

해결책

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

다른 팁

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

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*")'

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top