IAdmAttributeFriendlyNames

The IAdmAttributeFriendlyNames interface is used to specify display names for a directory property.

Inheritance: IUnknown

The IAdmAttributeFriendlyNames interface is implemented by the AdmAttributeFriendlyNames class.

 How to create an instance of the class
PowerShell
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

$attributeFriendlyNames = New-Object "Softerra.Adaxes.Management.AdmAttributeFriendlyNames"
C#
using Softerra.Adaxes.Management;

class Program
{
    static void Main(string[] args)
    {
        AdmAttributeFriendlyNames attributeFriendlyNames = new AdmAttributeFriendlyNames();
    }
}

Properties

Details

AttributeName

Gets or sets the property LDAP name.

  • Type:
  • string
  • Access:
  • Read/Write

GenericFriendlyName

Gets or sets a display name for the directory property specified in the AttributeName property.

  • Type:
  • string
  • Access:
  • Read/Write

Remarks

This display name is used only if it is not overridden for a specific object type.


TypeSpecificFriendlyNames

Gets or sets an array of IAdmTypeSpecificAttributeFriendlyName interfaces used to manage property display names for specific object types.

Examples

The following code sample sets "Purpose" display name for the Description property of groups.

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

# Bind 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 display names
$displayNames = $settingsContainer.GetAttributeFriendlyNames("eng", 
    "ADM_GETATTRFRIENDLYNAMESMODE_USERDEF")

# Create an instance of AdmTypeSpecificAttributeFriendlyName class
$typeSpecificDisplayName = New-Object `
    "Softerra.Adaxes.Management.AdmTypeSpecificAttributeFriendlyName"
$typeSpecificDisplayName.ObjectType = "group"
$typeSpecificDisplayName.FriendlyName = "Purpose"

# Set property display name for groups 
foreach($displayName in $displayNames)
{
    if ($displayName.AttributeName -ne "description")
    {
        continue
    }

    [System.Array]$typeSpecificFriendlyNames = 
        $displayName.TypeSpecificFriendlyNames | Where-Object {$_.ObjectType -ne "group"}
    $typeSpecificFriendlyNames += $typeSpecificDisplayName
    $displayName.TypeSpecificFriendlyNames = $typeSpecificFriendlyNames
    break
}

# Save the changes
$settingsContainer.SetAttributeFriendlyNames("eng", $displayNames)
$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");
        IAdmAttributeFriendlyNamesOps settingsContainer =
            (IAdmAttributeFriendlyNamesOps)service.OpenObject(settingsPath, null, null, 0);
        
        // Get property display names
        IAdmAttributeFriendlyNames[] displayNames =
            settingsContainer.GetAttributeFriendlyNames(
            "eng", ADM_GETATTRFRIENDLYNAMESMODE_ENUM.ADM_GETATTRFRIENDLYNAMESMODE_USERDEF);

        // Create an instance of AdmTypeSpecificAttributeFriendlyName class
        IAdmTypeSpecificAttributeFriendlyName typeSpecificDisplayName = 
            new AdmTypeSpecificAttributeFriendlyName();
        typeSpecificDisplayName.ObjectType = "group";
        typeSpecificDisplayName.FriendlyName = "Purpose";

        // Set property display name for groups
        foreach (IAdmAttributeFriendlyNames displayName in displayNames)
        {
            if (displayName.AttributeName != "description")
            {
                continue;
            }

            List<IAdmTypeSpecificAttributeFriendlyName> typeSpecificFriendlyNames =
                displayName.TypeSpecificFriendlyNames.ToList();
            typeSpecificFriendlyNames.RemoveAll(friendlyName => string.Equals(
                friendlyName.ObjectType, "group",
                StringComparison.CurrentCultureIgnoreCase));
            typeSpecificFriendlyNames.Add(typeSpecificDisplayName);
            displayName.TypeSpecificFriendlyNames = typeSpecificFriendlyNames.ToArray();
            break;
        }

        // Save the changes
        settingsContainer.SetAttributeFriendlyNames("eng", displayNames.ToArray());
        IAdmTop settingsContainer2 = (IAdmTop)settingsContainer;
        settingsContainer2.SetInfo();
    }
}

Requirements

Minimum required version: 2018.1

See also