Platform SDK: Active Directory, ADSI, and Directory Services

ldap_create_page_control

Use the ldap_create_page_control function to create a simple control for paging results. Support for this function is available effective with LDAP 3.

ULONG ldap_create_page_control(
  PLDAP ExternalHandle,
  ULONG PageSize,
  struct berval* Cookie,
  UCHAR IsCritical,
  PLDAPControl* Control
);

Parameters

ExternalHandle
[in] The session handle.
PageSize
[in] The number of entries to return in each page.
Cookie
[in] An opaque data structure, which the server uses to determine its location in the result set. Set to NULL for the first call to ldap_create_page_control.
IsCritical
[in] Tells the server whether this control is critical to the search.
Control
[out] Pointer to the newly created control.

Return Values

Value Meaning
LDAP_SUCCESS The call was completed successfully.
LDAP_UNAVAILABLE_CRIT_EXTENSION The control is critical and the server does not support the control.

Remarks

The ldap_create_page_control function creates a simple paged-results control. The control allows the client to specify the rate at which an LDAP server returns the results of a search operation. This is useful when the client has limited resources and may not be able to process the entire result set from a given LDAP query, or when the client/server connection is slow.

To create the paged-results control, specify the number of entries you want returned in a single page. If you want the server to return results normally, even if it cannot support this control, set the IsCritical parameter to FALSE.

When ldap_create_page_control returns successfully, include the newly created control to the list of server controls in a call to ldap_search_ext or to ldap_search_ext_s. When the server returns the first page of results, call ldap_parse_result to retrieve the first page of results.

Call ldap_control_free when the control is no longer needed.

Requirements

  Windows NT/2000: Requires Windows NT 4.0 SP4 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Winldap.h.
  Library: Use Wldap32.lib.
  Unicode: Declared as Unicode and ANSI prototypes.

See Also

Functions, ldap_control_free, ldap_parse_page_control, ldap_parse_result, ldap_search_ext, ldap_search_ext_s