WinNetworkBrowserADSearch Method (String, WinNetworkBrowserCriteriaTypes, String, String, String, String, WinNetworkBrowserADObjectClasses, String, String) Content Studio 5.7 SDK
Content Studio Web Content Management System

[This is preliminary documentation and is subject to change.]

Searches the Active Directory and returns the objects found along with optional properties.

Namespace: ContentStudio.Security
Assembly: CSServer5 (in CSServer5.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax

public string ADSearch(
	string criteria,
	WinNetworkBrowserCriteriaTypes criteriaType,
	string sidNameField,
	string site,
	string ou,
	string adsPath,
	WinNetworkBrowserADObjectClasses objectClass,
	string arrayDelimiter,
	string[] extraFields
)

Parameters

criteria
Type: SystemString
The search criteria, can be a regular search text or a Sid in the SSDL format e.g. S-1-5-21-3000480078-1234539488-920655208-1108. If the criteria is the samAccountName (login name) of an object, do not include the domain name with the criteria.
criteriaType
Type: ContentStudio.SecurityWinNetworkBrowserCriteriaTypes
The type of criteria passed in the criteria parameter
sidNameField
Type: SystemString
If the CriteriaType is sid this parameter contains the name of the sid field to search. If this parameter is null or Empty "objectSID" is used. This parameter is ignored if CriteriaType is not Sid. Normally this parameter is null
site
Type: SystemString

This parameter is ignored if adsPath is specified.

The domain to search in e.g. teknikhuset.com. If this parameter is null or Empty, ou must also be null or String.Empty.

ou
Type: SystemString

This parameter is ignored if adsPath is specified.

The OU:s (Organizational Unit) of the site to search in (e.g. Developers/Staff/Umeå). If there are underlying OU:s, these are included in the search as well. Specify null or Empty to search in the whole domain.

Note
This path must be written in the same order as the ADSPath i.e from the lowest OU in the hierarchy up to the root OU.

adsPath
Type: SystemString
An LDAP path to use. Pass null or String.Empty to use the site / ou parameters instead. If all these 3 parameters is unspecified the current domain is used.
objectClass
Type: ContentStudio.SecurityWinNetworkBrowserADObjectClasses
Defines what type of object to find.
To findUse
UsersADObjectClasses.Top or ADObjectClasses.Person or ADObjectClasses.User or ADObjectClasses.UsersAndGroups
GroupsADObjectClasses.Top or ADObjectClasses.Group or ADObjectClasses.UsersAndGroups
ComputersADObjectClasses.Top or ADObjectClasses.Person or ADObjectClasses.Computer
ContactADObjectClasses.Top or ADObjectClasses.Person or ADObjectClasses.Computer
arrayDelimiter
Type: SystemString
A delimiter to use in case a property sought for contains more than one value. If this parameter is if omitted, a pipe surrounded by blanks (" | ") is used.
extraFields
Type: SystemString
An array of that defines one or more of the extra fields that should be returned. This parameter can be null or an empty array. As default only the type, cn, and ADSPath will be returned. To return the NT login domain use the "domainNetBIOSName" field name.

Return Value

Type: String
Xml with the following sample xml syntax (the attributes returned in the object element varies depending on the AD-fields selected).
<root>
  <status>0</status>
  <statustext>Success</statustext>
  <list>
    <object type="user" 
               cn="Linda Liar" 
               adspath="LDAP://CN=Liar Linda,OU=Development Unit,DC=theCompany,DC=com" 
               objectsid="S-1-5-21-2060480071-1212121288-620655208-1145" 
               samaccountname="lialin" 
               telephonenumber="" />
  </list>
</root>
Exceptions

ExceptionCondition
CSExceptionA business rule was violated in the underlying Content Studio database
CSInvalidParameterExceptionA parameter has an invalid value
DirectoryServicesCOMExceptionA call to the underlying directory service resulted in an error, such as "There is no such object on the server".
ActiveDirectoryOperationExceptionA call to the underlying directory service resulted in an error.
Remarks

This method is used by the AD Object Picker component and returns a maximum of DEFAULT_SEARCH_SIZE number of items.
Examples

The following code snippet shows how to search for a user in Active Directory and return some fields of data.

//Define a search criteria
var criteria = "*Linda";
//define an number of fields to return (AD field names can be case sensitive)
var extraFields = new string[5] { "cn", "objectClass", "objectSID", "samAccountName", "telephoneNumber" };
var wnb = new WinNetworkBrowser();
//The xml returned is the one documented here as return value
var xml = wnb.ADSearch(criteria,
                       WinNetworkBrowser.CriteriaTypes.Regular,
                       "objectSID",
                       "theCompany.com",
                       "Development Unit",
                       null,
                        WinNetworkBrowser.ADObjectClasses.User,
                       ",",
                       extraFields);
See Also

Reference