简体   繁体   中英

How to get distinct values of a managed property through SharePoint search?

I am building a phone catalog of my organization (an AJAX application which accesses the search.asmx web service). I'd like to show a list box where the user could select a department (which is stored in managed property Department ). To fill the list box with values, I need to somehow select all the distinct values of that property. Is it possible through search.asmx web service?

What I've found:

  • an article, which states that it is possible , but it does not use the web service interface
  • a Microsoft's white paper which states that "If the protocol client specifies at least one property, it MUST also specify the Path property. If it does not, the protocol server MUST return the status code "ERROR_BAD_QUERY"."

The two findings are somewhat inconsistent. (and, yes the search really returns ERROR_BAD_QUERY).

Why bother to check with the web service or complicate it?

  1. Get all the properties into a DataTable.
  2. Then create a DataView & then you can apply the DISTINCT on required column.
  3. Finally use it to bind to your list box.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM