Share via


Paging Search Results (Windows Embedded CE 6.0)

1/6/2010

When an LDAP client is accessing a server across a slow link, or the client suspects that the result set from a given query may be very large, the client should be able to retrieve the result set in small pieces. The simple paged-result extended control allows this type of retrieval by allowing a one-way walk through a result set. Options on this control allow the client to set the initial page size and reset the page size with each subsequent request to the server.

The client sends the server a search request with the simple paged-result control with an empty previous enumeration key (also known as a cookie) and the initial page size. The server then returns the number of entries specified by the page size and returns a cookie that is used on the next client request to get the next page of results. The client then issues a search with the cookie included (optionally resetting the page size) and the server responds with up to that number of entries.

Paged results are indicated as a control on the ldap_search_ext function call. Use ldap_create_page_control to construct this control and then call ldap_search_ext to add the control. This control structure must then be added to the list of server controls in the ldap_search_ext call. When the server returns the first page of results, it includes the resume cookie in the controls field of the SearchResultDone message. The client must then extract the cookie from the search result by retrieving the server controls using the ldap_parse_result function and parsing the control with the ldap_parse_page_control function. The client then uses the cookie in the next call to ldap_create_page_control to retrieve the next page of results.

See Also

Concepts

Processing Search