Directory Services

ldap_first_entry

The ldap_first_entry function returns the first entry of a message.

LDAPMessage* ldap_first_entry(
  LDAP* ld,
  LDAPMessage* res
);

Parameters

ld
[in] The session handle.
res
[in] The search result, as obtained by a call to one of the synchronous search routines or ldap_result.

Return Values

If the search returned valid results, this function returns a pointer to the first result entry. If no entry or reference exists in the result set, it returns NULL. This is the only error return; the session error parameter in the LDAP data structure is cleared to 0 in either case.

Remarks

Use ldap_first_entry in conjunction with ldap_next_entry to step through and retrieve the list of entries from a search result chain.

You do not have to explicitly free the returned entry as it is freed when the message itself is freed.

Requirements

Client: Included in Windows XP and Windows 2000 Professional.
Server: Included in Windows Server 2003 and Windows 2000 Server.
Redistributable: Requires Active Directory Client Extension on Windows NT 4.0 SP6a and Windows 95/98/Me.
Header: Declared in Winldap.h.
Library: Use Wldap32.lib.

See Also

Functions, ldap_next_entry, ldap_result