IAdmContainer
The IAdmContainer interface extends the IADsContainer interface with the ability to restore deleted Active Directory objects.
Inheritance: IADsContainer
Methods
-
Method
-
Description
-
RestoreHere()
-
Restores a deleted Active Directory object to the container.
Details
RestoreHere()
Restores a deleted Active Directory object to the container.
IAdmTop RestoreHere(String adsPath,
String newRdn,
Boolean 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 $admNS = New-Object("Softerra.Adaxes.Adsi.AdmNamespace") $admService = $admNS.GetServiceDirectly("localhost") # Bind to container $ou = $admService.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 adsNS = new AdmNamespace(); IAdmService admService = adsNS.GetServiceDirectly("localhost"); // Bind to container IAdmContainer ou = (IAdmContainer)admService.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 Boolean restoreChildObjects = false; ou.RestoreHere(deletedObjectPath, newRdn, restoreChildObjects); } }
Requirements
Minimum required version: 2018.1