IAdmUsernamePropertyPatternItem

The IAdmUsernamePropertyPatternItem interface represents the domain suffix selection restrictions for the Username property.

Inheritance: IAdmPropertyPatternItem

Properties

  • Property

  • Description

  • DomainOptions

  • Gets or sets the domain selection restrictions.

Details

DomainOptions

Gets or sets 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 removes all the domain selection restrictions in 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")
    {
       $item.DomainOptions = $null
       $item.SetInfo()
    }
}
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;
                usernameItem.DomainOptions = null;
                usernameItem.SetInfo();
            }
        }
    }
}

Requirements

Minimum required version: 2023

See also