IAdmAttributeAliasesOps

The IAdmAttributeAliasesOps interface is used to manage aliases of directory properties.

Inheritance: IUnknown

To use the IAdmAttributeAliasesOps interface, you need to bind to the Configuration Set Settings container using the "ConfigurationSetSettings" alias.

Methods

Details

GetAliases()

Returns an array of property aliases.

IAdmAttributeAlias[] GetAliases(ADM_GETATTRALIASMODE_ENUM attributeAliasesType)

Parameters

The attributeAliasesType parameter specifies what property aliases to return. You can retrieve built-in property aliases provided out of the box, modified property aliases or a merged array of modified and built-in property aliases.

Examples

The following code sample outputs modified property aliases.

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

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

# Bind to the 'Configuration Set Settings' container
$settingsPath = $service.Backend.GetConfigurationContainerPath(`
    "ConfigurationSetSettings")
$settingsContainer = $service.OpenObject($settingsPath, $null, $null, 0)

# Get property aliases
$aliases = $settingsContainer.GetAliases("ADM_GETATTRALIASMODE_USERDEF")

foreach ($alias in $aliases)
{
    Write-Host $alias.AliasName
    Write-Host $alias.AttributeNames
    Write-Host
}
C#
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.Management;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service
        AdmNamespace ns = new AdmNamespace();
        IAdmService service = ns.GetServiceDirectly("localhost");

        // Bind to the 'Configuration Set Settings' container
        string settingsPath = service.Backend.GetConfigurationContainerPath(
            "ConfigurationSetSettings");
        IAdmAttributeAliasesOps settingsContainer = (IAdmAttributeAliasesOps)service.OpenObject(
            settingsPath, null, null, 0);

        // Get property aliases
        IAdmAttributeAlias[] aliases =
            settingsContainer.GetAliases(ADM_GETATTRALIASMODE_ENUM.ADM_GETATTRALIASMODE_USERDEF);
        foreach (IAdmAttributeAlias alias in aliases)
        {
            Console.WriteLine(alias.AliasName);
            Console.WriteLine(string.Join(";", alias.AttributeNames));
            Console.WriteLine();
        }
    }
}

SetAliases()

Sets the given property aliases.

void SetAliases(IAdmAttributeAlias[] aliases)

Remarks

To save the changes, call IADs::SetInfo after calling this method.

Examples

The following code sample sets an alias for the CustomAttributeText1 property.

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

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

# Bind to the 'Configuration Set Settings' container
$settingsPath = $service.Backend.GetConfigurationContainerPath(`
    "ConfigurationSetSettings")
$settingsContainer = $service.OpenObject($settingsPath, $null, $null, 0)

# Specify property alias
$attributeAlias = New-Object "Softerra.Adaxes.Management.AdmAttributeAlias"
$attributeAlias.AliasName = "details"
$attributeAlias.AttributeNames = @("adm-CustomAttributeText1")

# Get property aliases
[System.Array]$aliases = $settingsContainer.GetAliases("ADM_GETATTRALIASMODE_USERDEF") | Where-Object {$_.AliasName -ne "details"}

# Add new property alias
$aliases += $attributeAlias

# Save the changes
$settingsContainer.SetAliases($aliases)
$settingsContainer.SetInfo()
C#
using System;
using System.Collections.Generic;
using System.Linq;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.Management;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;
using Softerra.Adaxes.Management;

class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service
        AdmNamespace ns = new AdmNamespace();
        IAdmService service = ns.GetServiceDirectly("localhost");

        // Bind to the 'Configuration Set Settings' container
        string settingsPath = service.Backend.GetConfigurationContainerPath(
            "ConfigurationSetSettings");
        IAdmAttributeAliasesOps settingsContainer = (IAdmAttributeAliasesOps)service.OpenObject(
            settingsPath, null, null, 0);

        // Specify property alias
        IAdmAttributeAlias attributeAlias = new AdmAttributeAlias();
        attributeAlias.AliasName = "details";
        attributeAlias.AttributeNames = new string[] {"adm-CustomAttributeText1"};

        // Get property aliases
        List<IAdmAttributeAlias> aliases =
            settingsContainer.GetAliases(
            ADM_GETATTRALIASMODE_ENUM.ADM_GETATTRALIASMODE_USERDEF).ToList();
        aliases.RemoveAll(alias => string.Equals(
            alias.AliasName, "details",
            StringComparison.CurrentCultureIgnoreCase));

        // Add new property alias
        aliases.Add(attributeAlias);

        // Save the changes
        settingsContainer.SetAliases(aliases.ToArray());
        IAdmTop settingsContainer2 = (IAdmTop)settingsContainer;
        settingsContainer2.SetInfo();
    }
}

Requirements

Minimum required version: 2018.1

See also