Skip to content

IAdmAttributeFriendlyNames

The IAdmAttributeFriendlyNames interface is used to specify display names for an Active Directory property.

Inheritance: The IAdmAttributeFriendlyNames interface inherits from the IUnknown interface.

Note

The IAdmAttributeFriendlyNames interface is implemented by the AdmAttributeFriendlyNames class.

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

$attributeFriendlyNames = New-Object "Softerra.Adaxes.Management.AdmAttributeFriendlyNames"
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 Active 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.

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

# Bind to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the 'Configuration Set Settings' container
$settingsPath = $admService.Backend.GetConfigurationContainerPath(`
    "ConfigurationSetSettings")
$settingsContainer = $admService.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()
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 adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Bind to the 'Configuration Set Settings' container
        string settingsPath = admService.Backend.GetConfigurationContainerPath(
            "ConfigurationSetSettings");
        IAdmAttributeFriendlyNamesOps settingsContainer =
            (IAdmAttributeFriendlyNamesOps)admService.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