Native
Synchronous
No Custom Parameters
Query will connect and perform a search on an LDAP server.
Query performs a search with the specified attributes in the Attributes action parameter and returns the results in a System.Data.DataTable variable. A common practice is to pass this variable into a CustomCode block for parsing the data within it.
The following code shows how one would retrieve the an attribute of name cn from every found entry in the DataTable returned by a successful query in a CustomCode block:
Example 19.1. Retrieving an Attribute from an LDAP uery
public static string Execute(DataTable resultsFromQuery, ArrayList allCns)
{
if(resultsFromQuery != null)
{
foreach(DataRow row in resultsFromQuery.Rows)
{
string cn = row["cn"] as string;
if(cn == null || cn == String.Empty)
{
// this would presumably be an unexpected error that should be dealt with specific to the application
}
else
{
allCns.Add(cn);
}
}
}
return "success";
}
The branch condition returned provides useful information in determining the cause of failure:
ConnectionFailure indicates that it was not possible to connect to the LDAP server.
AuthenticationFailure indicates that the Username and Password do not have the necessary permissions to bind to the LDAP server.
SearchFailure indicates that the Query action was unable perform a search on the LDAP server.
Failureor that the action failed unexpectedly for a non-LDAP protocol related reason.
None.
| Parameter Name | .NET Type | Default | Description |
|---|---|---|---|
| LdapServerHost * | System.String | The IP address or host name of the LDAP server. | |
| LdapServerPort | System.UInt32 | 0 | The port of the LDAP server. |
| Username | System.String | A user that has the appropriate permissions to search with. | |
| Password | System.String | The password of the user specified in the Username action parameter. | |
| BaseDn | System.String | The base DN to query on. | |
| SearchFilter | System.String | The LDAP protocol-formatted search criteria. | |
| Attributes | System.String[] | Specify explicit attributes to return only | |
| Version | System.Int32 | 3 | The version of the LDAP server being connected to. |
| Parameter Name | .NET Type | Description |
|---|---|---|
| SearchResults | System.Data.DataTable | A .NET System.Data.DataTable that contains rows and columns corresponding to the entries and attributes returned for the query. |
| ErrorCode | System.Int32 | An LDAP protocol-specific error code if the action fails due to SearchFailure, AuthenticationFailure, or ConnectionFailure. Note that in any of these three cases, it is not guaranteed that the error code will be populated. The error code will be 0 in the case that no LDAP-specific error code could be found. |
| ErrorMessage | System.String | An LDAP protocol-specific error message if the action fails due to SearchFailure, AuthenticationFailure, or ConnectionFailure. Note that in any of these three cases, it is not guaranteed that the error message will be populated. The error code will be null in the case that no LDAP-specific error message could be found. |
Branch Conditions
No description.
No description.
No description.
No description.
No description.
No description.