Compartir a través de


LDAP Paged Search Technology Sample

This sample demonstrates performing a paged search of the Active Directory using LDAP controls. A paged search enables results to be received in pages. This sample is available only in Visual C#.

For information about using the samples, see the following topics:

To build the sample

  1. Open a Command Prompt window and navigate to the PagedSearch\CS directory.

  2. Type msbuild pagedsearch.sln at the command line.

To run the sample

  1. Navigate to the directory that contains the built executable file, using the command prompt.

  2. Type pagedsearch followed by its arguments and press Enter.

This sample has the following syntax:

pagedsearch <ldapServer> <user> <pwd> <domain> <targetOU> 
  • ldapServer
    The LDAP server.
  • user
    Your user name.
  • pwd
    Your password.
  • domain
    The Active Directory domain.
  • targetOU
    The target organizational unit (OU).

Here is an example:

PagedSearch myDC1.testDom.fabrikam.com user1 secret@~1 testDom OU=samples,DC=testDom,DC=fabrikam,DC=com

NoteNote

This sample is a console application. You must start and run it in a Command Prompt window to view its output.

Remarks

This sample defines the following methods.

Method Description

CreateConnection

Connects to the server using a LdapConnection.

CreateObjectsToSearch

Adds a number of objects to the directory to be used in searching.

DoPagedSearch

Performs a paged search with a specified scope and attributes to return.

DeleteObjectsToSearch

Deletes the objects created for searching.