IAdmCriteria
The IAdmCriteria interface represents criteria for directory object queries.
Methods
-
Method
-
Description
-
CreateSimple()
-
Creates a simple criteria item.
-
CreateCompound()
-
Creates a compound criteria item.
-
CreateAdvanced()
-
Creates an advanced criteria item.
-
CreateFromJson()
-
Creates a criteria or a criteria item from a JSON representation.
-
AddType(string, IAdmCompoundCriteriaItem)
-
Adds the specified object type to this criteria, and sets the criteria items for that object type.
-
AddType(string, string)
-
Adds the specified object type to this criteria and creates its criteria items from a criteria expression.
-
RemoveType()
-
Removes the specified object type.
-
RemoveAllTypes()
-
Removes all object types.
-
GetCriteriaFor()
-
Gets the criteria items that apply to the specified object type.
-
Equals()
-
Determines whether the specified criteria is equal to this criteria.
-
MergeWith()
-
Merges this criteria with another criteria.
-
Clone()
-
Creates a deep copy of this criteria.
Properties
-
Property
-
Description
-
ObjectTypes
-
Gets all object types included in this criteria.
Details
CreateSimple()
Creates a new SimpleCriteriaItem instance.
IAdmSimpleCriteriaItem CreateSimple()
CreateCompound()
Creates a new CompoundCriteriaItem instance.
IAdmCompoundCriteriaItem CreateCompound()
CreateAdvanced()
Creates a new CreateAdvanced instance.
IAdmAdvancedCriteriaItem CreateAdvanced()
CreateFromJson()
Creates a criteria or a criteria item from a JSON representation.
object CreateFromJson(string json)
Parameters
The json parameter specifies a JSON representation of criteria or a criteria item.
AddType(string, CompoundCriteriaItem)
Adds the specified object type to this criteria, and sets the criteria items for that object type.
void AddType(string objectType, IAdmCompoundCriteriaItem criteriaItem)
Parameters
- objectType – Specifies the name of the object type to add. The name must exactly match the name of the corresponding object class in your directory schema e.g. user, group.
- criteriaItem – Specifies the criteria item to set. If this parameter is set to
null
, an empty compound criteria item will be set.
Examples
The following code sample adds two object types and sets the base criteria items for them.
- PowerShell
-
$criteria = YOUR-CRITERIA # Create compound criteria item. $item = $criteria.CreateCompound() # Add object type with its criteria item. $criteria.AddType("user", $item)
- C#
-
using Softerra.Adaxes.Directory.Criteria; using Softerra.Adaxes.Interop.Adsi.Criteria; class Program { public static void Main() { IAdmCriteria criteria = new Criteria(); // Create compound criteria item. IAdmCompoundCriteriaItem item = new CompoundCriteriaItem(); // Add object type with its criteria item. criteria.AddType("user", item); } }
AddType(string, string)
Adds the specified object type to this criteria, and generates its criteria items from a criteria expression. For details about building criteria expressions, see How to build criteria.
void AddType(string objectType, string criteriaItem)
Parameters
- objectType – Specifies the name of the object type to add. The name must exactly match the name of the corresponding object class in your directory schema e.g. user, group.
- criteriaItem – Specifies the criteria expression.
Examples
The following code sample creates criteria that matches all users from the London office.
- PowerShell
-
$criteria = YOUR-CRITERIA # Add criteria for the User object type. $criteria.AddType("user", {physicalDeliveryOfficeName -eq "London"})
- C#
-
// Criteria expressions can be used in PowerShell only.
RemoveType()
Removes the specified object type from this criteria.
void RemoveType(string objectType)
RemoveAllTypes()
Removes all object types from this criteria.
void RemoveAllTypes()
GetCriteriaFor()
Gets the base criteria item for the specified object type.
IAdmCompoundCriteriaItem GetCriteriaFor(string objectType)
Equals()
Determines whether the specified criteria is equal to this criteria.
bool Equals(IAdmCriteria criteria)
Parameters
The criteria parameter specifies a criteria to compare with this criteria.
MergeWith()
Merges this criteria with another criteria, and returns a new criteria with the merged items combined by the specified logical operator.
IAdmCriteria MergeWith(IAdmCriteria criteria, LogicalOperator logicalOperator)
Parameters
- criteria – Specifies the criteria to merge with this criteria.
- logicalOperator – Specifies the logical operator that will be used to combine two criteria.
Examples
- PowerShell
-
$criteria1 = YOUR-CRITERIA $criteria2 = YOUR-CRITERIA $mergedCriteria = $criteria1.MergeWith($criteria2, "AND")
- C#
-
using Softerra.Adaxes.Directory.Criteria; using Softerra.Adaxes.Interop.Adsi.Criteria; class Program { public static void Main() { IAdmCriteria criteria1 = <YOUR-CRITERIA> IAdmCriteria criteria2 = <YOUR-CRITERIA> IAdmCriteria mergedCriteria = criteria1.MergeWith(criteria2, LogicalOperator.And); } }
Clone()
Creates a deep copy of this criteria.
IAdmCriteria Clone()
ObjectTypes
Gets the names of all object types included in this criteria.
- Type:
- string[]
- Access:
- Read-only
Requirements
Minimum required version: 2023