IAdmRuleBasedGroupQueries

The IAdmRuleBasedGroupQueries interface is used to perform queries related to rule-based groups.

Inheritance: IUnknown

Methods

Details

GetRuleBasedGroups()

Returns GUIDs of all rule-based groups.

Guid[] GetRuleBasedGroups()

Examples

The following code sample outputs distinguished names (DNs) of all rule-based groups.

PowerShell
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$ns = New-Object("Softerra.Adaxes.Adsi.AdmNamespace")
$service = $ns.GetServiceDirectly("localhost")

# Get GUIDs of all rule-based groups
$queries = $service.GetRemoteObject("ADM_SERVICEOBJECTID_RULEBASEDGROUPQUERIES")
$ruleBasedGroupGuids = $queries.GetRuleBasedGroups()

# Output distinguished names of the groups
foreach ($ruleBasedGroupGuid in $ruleBasedGroupGuids)
{
    # Get distinguished name of the group
    $ruleBasedGroup = $service.OpenObject("Adaxes://<GUID=$ruleBasedGroupGuid>", $null, $null, 0)
    $ruleBasedGroupDN = $ruleBasedGroup.Get("distinguishedName")
    
    Write-Host $ruleBasedGroupDN
}
C#
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;
class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service
        var ns = new AdmNamespace();
        IAdmService service = ns.GetServiceDirectly("localhost");

        // Get GUIDs of all rule-based groups
        IAdmServiceObjectProvider serviceObjectProvider = (IAdmServiceObjectProvider)service;
        IAdmRuleBasedGroupQueries queries = 
            (IAdmRuleBasedGroupQueries)serviceObjectProvider.GetRemoteObject(
                ADM_SERVICEOBJECTID_ENUM.ADM_SERVICEOBJECTID_RULEBASEDGROUPQUERIES);
        Guid[] ruleBasedGroupGuids = queries.GetRuleBasedGroups();

        // Output distinguished names of the groups
        foreach (Guid ruleBasedGroupGuid in ruleBasedGroupGuids)
        {
            // Get distinguished name of the group
            string ruleBasedGroupPath = string.Format("Adaxes://<GUID={0}>", ruleBasedGroupGuid);
            IADsGroup ruleBasedGroup = (IADsGroup)service.OpenObject(ruleBasedGroupPath, null, null, 0);
            string ruleBasedGroupDN = (string)ruleBasedGroup.Get("distinguishedName");

            Console.WriteLine(ruleBasedGroupDN);
        }        
    }
}

Requirements

Minimum required version: 2020.1

See also