IAdmContainer

The IAdmContainer interface extends the IADsContainer interface with the ability to restore deleted directory objects.

Inheritance: IADsContainer

Methods

  • Method

  • Description

  • RestoreHere()

  • Restores a deleted directory object to the container.

Details

RestoreHere()

Restores a deleted directory object to the container.

IAdmTop RestoreHere(string adsPath,
                    string newRdn,
                    bool restoreChildObjects

Parameters

  • adsPath - Specifies the ADS path of the object to be restored. The ADS path can be DN-based (e.g. Adaxes://CN=John Smith\0ADEL:eb5feb21-e648-42ad-b86c-89d3c6807953,CN=Deleted Objects,DC=example,DC=com) or GUID-based (e.g. Adaxes://<GUID=90495758-7E98-47B6-AA98-5B49129EF1DB>).
  • newRdn - Specifies the relative distinguished name (RDN) of the restored object within the container. If set to null, the object will have the same name as before it was deleted.
  • restoreChildObjects - If set to true, all child objects will be restored along with the specified object.

Examples

The following code sample restores a user with a new relative distinguished name (RDN).

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 container
$ou = $service.OpenObject("Adaxes://CN=Users,DC=example,DC=com",
    $null, $null, 0)

# Restore user
$deletedObjectPath = "Adaxes://example.com/CN=John Smith" +
    "\0ADEL:eb5feb21-e648-42ad-b86c-89d3c6807953," + 
    "CN=Deleted Objects,DC=example,DC=com"
$newRdn = "CN=Ann Jones"
$restoreChildObjects = $false
$ou.RestoreHere($deletedObjectPath, $newRdn, $restoreChildObjects)
C#
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 ns = new AdmNamespace();
        IAdmService service = ns.GetServiceDirectly("localhost");

        // Bind to container
        IAdmContainer ou = (IAdmContainer)service.OpenObject(
            "Adaxes://OU=Sales,DC=example,DC=com", null, null, 0);

        // Restore user
        const string deletedObjectPath = @"Adaxes://example.com/CN=John Smith" +
            @"\0ADEL:eb5feb21-e648-42ad-b86c-89d3c6807953," +
            @"CN=Deleted Objects,DC=example,DC=com";
        const string newRdn = "CN=Ann Jones";
        const bool restoreChildObjects = false;
        ou.RestoreHere(deletedObjectPath, newRdn, restoreChildObjects);
    }
}

Requirements

Minimum required version: 2018.1

See also