IAdmTop3
The IAdmTop3 interface extends the IAdmTop interface with three methods: SetInfo2, SetInfoEx2 and ExecuteCustomCommand.
Inheritance: IUnknown
Methods
-
Method
-
Description
-
SetInfo2()
-
Persists the changes made on the object to the directory.
-
SetInfoEx2()
-
Persists the changes of the specified properties to the directory.
-
ExecuteCustomCommand()
-
Executes a custom command on the object.
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.
- 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 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")
- 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 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 custom command identifier.
Examples
The following code sample executes custom command Deprovision on all users located in an Organizational Unit.
- PowerShell
-
[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) }
- 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) { // 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