IAdmUsernamePropertyPatternItemInfo

The IAdmUsernamePropertyPatternItemInfo interface provides information about the domain suffix selection restrictions for the Username property.

Inheritance: IAdmPropertyPatternItemInfo

Properties

Details

DomainOptions

Gets the domain selection restrictions. Each key in the key/value pair is a managed domain name, while each value is represented by IAdmUsernameDomainSelectionOptions.

Examples

The following script sample gets all the domain selection restrictions of the built-in User property pattern.

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

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

# Build the ADS path of the User property pattern and bind to it.
$containerPath = $service.Backend.GetConfigurationContainerPath("PropertyPatterns")
$propertyPatternsPathObj = New-Object "Softerra.Adaxes.Adsi.AdsPath" $containerPath
$builtinPathObj = $propertyPatternsPathObj.CreateChildPath("CN=Builtin")
$userPatternPath = $builtinPathObj.CreateChildPath("CN=User")

$pattern = $service.OpenObject($userPatternPath.ToString(), $null, $null, 0)

# Get the item for the Username property.
foreach ($item in $pattern.Items)
{
    if ($item.PropertyName -ieq "userPrincipalName")
    {
        $domainOptions = $item.DomainOptions
    }
}
C#
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;
using Softerra.Adaxes.Interop.Adsi.PropertyPatterns;
class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service.
        AdmNamespace ns = new AdmNamespace();
        IAdmService service = ns.GetServiceDirectly("localhost");

        // Build the ADS path of the User property pattern and bind to it.
        string containerPath = service.Backend.GetConfigurationContainerPath("PropertyPatterns");
        AdsPath propertyPatternsPathObj = new AdsPath(containerPath);
        AdsPath builtinPathObj = propertyPatternsPathObj.CreateChildPath("CN=Builtin");
        AdsPath userPatternPath = builtinPathObj.CreateChildPath("CN=User");

        IAdmPropertyPattern pattern = (IAdmPropertyPattern)service.OpenObject(
            userPatternPath.ToString(), null, null, 0);

        // Get the item for the Username property.
        foreach (IAdmPropertyPatternItem item in pattern.Items)
        {
            if (StringComparer.OrdinalIgnoreCase.Equals("userPrincipalName", item.PropertyName))
            {
                IAdmUsernamePropertyPatternItem usernameItem = (IAdmUsernamePropertyPatternItem)item;
                IAdmKeyValuePair[] domainOptions = usernameItem.DomainOptions;
            }
        }
    }
}

Requirements

Minimum required version: 2023

See also