Share via


LDAP Send Request Technology Sample

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

This sample demonstrates the use of the LdapConnection class to perform various directory operations. 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 SendRequest\CS directory.

  2. Type msbuild sendrequest.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 sendrequest followed by its arguments and press Enter.

This sample has the following syntax:

sendrequest <ldapServer> <user> <pwd> <domain> <targetOU>
  • ldapServer
    The server.

  • user
    Your user name.

  • pwd
    Your password.

  • domain
    The Active Directory domain.

  • targetOU
    The target organizational unit (OU).

Here is an example:

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

Note

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.

Add

Sends a request to add new objects in the directory.

Modify

Sends a request to modify an object in the directory.

Rename

Sends a request to rename an object.

Move

Sends a request to move an object in the directory.

Compare

Compares an attribute of an object with a specified value.

Search

Sends a request to search the directory using an LDAP search filter with a specified scope and attributes to return.

DeleteLeafObject

Sends a request to delete an object in the directory.

DeleteTree

Sends a request to delete an object containing child objects in the directory.