Skip to content

IAdmTop3

The IAdmTop3 interface extends the IAdmTop interface with three methods: SetInfo2, SetInfoEx2 and ExecuteCustomCommand.

Inheritance: The IAdmTop3 interface inherits from the IUnknown interface.

Methods

Details

SetInfo2()

Persists the changes made on the object to the directory. This method allows any value references specified in the object properties to be resolved.

void SetInfo2(ADM_SETINFOPARAMS_ENUM resolveValueRef)

Parameters

The resolveValueRef parameter determines whether value references must be resolved on the server side prior to saving changes to the directory. When set to ADM_SETINFOPARAMS_RESOLVEVALUEREFERENCES, all value references contained in object properties are resolved. Otherwise, when set to ADM_SETINFOPARAMS_NONE, value references will not be resolved.

Examples

The following code sample sets the description of a user to the value of the Job Title property.

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

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

# Bind to the user
$userDN = "CN=John Smith,CN=Users,DC=domain,DC=com"
$user = $admService.OpenObject("Adaxes://$userDN", $NULL, $NULL, 0)

# Update the description
$user.Put("description", "%title%")

# Save changes
$user.SetInfo2("ADM_SETINFOPARAMS_RESOLVEVALUEREFERENCES")
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

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

        // Bind to the user
        const String userPath = "Adaxes://CN=John Smith,CN=Users,DC=domain,DC=com";
        IADs user = (IADs) admService.OpenObject(userPath, null, null, 0);

        // Update the description
        user.Put("description", "%title%");

        // Save changes
        IAdmTop3 user2 = (IAdmTop3) user;
        user2.SetInfo2(ADM_SETINFOPARAMS_ENUM.ADM_SETINFOPARAMS_RESOLVEVALUEREFERENCES);
    }
}

SetInfoEx2()

Persists the changes of the specified properties to the directory. This method allows any value references specified in the object properties to be resolved.

void SetInfoEx2(String[] properties, ADM_SETINFOPARAMS_ENUM resolveValueRef)

Parameters

  • properties - An array of String entries listing the property names to persist.
  • resolveValueRef - Determines whether value references must be resolved on the server side prior to saving changes to the directory. When set to ADM_SETINFOPARAMS_RESOLVEVALUEREFERENCES, all value references contained in object properties are resolved. Otherwise, when set to ADM_SETINFOPARAMS_NONE, value references will not be resolved.

ExecuteCustomCommand()

Executes a Custom Command on the object.

void ExecuteCustomCommand(String customCommandGUID)

Parameters

The customCommandGUID parameter is a String that represents the GUID of the Custom Command to be executed. See also: Get the ID of a Custom Command.

Examples

The following code sample executes Custom Command Deprovision on all users located in an Organizational Unit.

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

# Custom Command 'Deprovision'
$deprovisionCustomCommandId = "{9DB88EC3-1241-4AB1-9612-C7C982BAA49F}"

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

# Bind to an Organizational Unit
$containerDN = "OU=Expired Accounts,DC=domain,DC=com"
$container = $admService.OpenObject("Adaxes://$containerDN", $NULL, $NULL, 0)

# Run the Custom Command for all users in the Organizational Unit
$container.Filter = @("user")

foreach ($user in $container)
{
    $user.ExecuteCustomCommand($deprovisionCustomCommandId)
}
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;

class Program
{
    static void Main(string[] args)
    {
        // Custom Command 'Deprovision'
        const String deprovisionCustomCommandId = "{9DB88EC3-1241-4AB1-9612-C7C982BAA49F}";

        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Bind to an Organizational Unit
        const String containerPath = "Adaxes://OU=Expired Accounts,DC=domain,DC=com";
        IADsContainer container = (IADsContainer) admService.OpenObject(
            containerPath, null, null, 0);

        // Run the Custom Command for all users in the Organizational Unit
        container.Filter = new object[] { "user" };

        foreach (IAdmTop3 user in container)
        {
            user.ExecuteCustomCommand(deprovisionCustomCommandId);
        }
    }
}

Requirements

Minimum required version: 2011.1

See also