IAdmCriteria

The IAdmCriteria interface represents criteria for directory object queries.

Methods

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

  • json – 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 – 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 – 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
{
    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 – 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 – the criteria expression.

Examples

The following code sample creates criteria that matches all users from the London office.

$criteria = YOUR-CRITERIA

# Add criteria for the User object type.
$criteria.AddType("user", {physicalDeliveryOfficeName -eq "London"})

Remarks

Criteria expressions can only be used in PowerShell.


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)

Remarks

A base criteria item or a root criteria item is a CompoundCriteriaItem that nests all other criteria for a particular object type.


Equals()

Determines whether the specified criteria is equal to this criteria.

bool Equals(IAdmCriteria criteria)

Parameters

  • criteria – the 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 – the criteria to merge with this criteria.
  • logicalOperator – 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
{
    static void Main()
    {
        IAdmCriteria criteria1 = <YOUR-CRITERIA>
        IAdmCriteria criteria2 = <YOUR-CRITERIA>

        IAdmCriteria mergedCriteria = 
                criteria1.MergeWith(criteria2, LogicalOperator.And);
    }
}   

Remarks

Criteria are merged as is. Adaxes does not validate whether there are any duplicate or conflicting conditions.


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

See also