DESCRIPTION
This C# sample code demonstrates how to issue an approval-aware modify operation.
Note This code may use interfaces from ActiveRoles Server ADSI Provider Type Library (EDMLib). Please, add a reference to to the ActiveRoles Server ADSI Provider Type Library (EDMLib) to your C# project.
CODE
//*********************************************************************************
//THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
//EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
//WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
//IF YOU WANT THIS FUNCTIONALITY TO BE CONDITIONALLY SUPPORTED,
//PLEASE CONTACT ONE IDENTITY PROFESSIONAL SERVICES.
//*********************************************************************************
//----- bind to AD object -----
DirectoryEntry deUser = new DirectoryEntry("EDMS://CN=John Smith,OU=Sales,DC=foocompany,DC=com");
deUser.Properties["description"].Value = "senior manager";
//----- set the control AllowApproval to check if an approval is required -----
(deUser.NativeObject as IEDM).set_Control("AllowApproval", true, "Check");
//----- try to perform ------
deUser.CommitChanges();
//----- verify if this operation requires an approval -----
if ("Pending" == ((deUser.NativeObject as IEDM).get_Control("OperationStatus", true) as string))
{
//----- set the control AllowApproval to send the operation for approval -----
(deUser.NativeObject as IEDM).set_Control("AllowApproval", true, "Confirm");
//----- set the control OperationReason with details about the approval request -----
(deUser.NativeObject as IEDM).set_Control("OperationReason", true, "some reason that will be shown approver");
//----- try to perform AGAIN ------
deUser.CommitChanges();
}
//***** END OF CODE **************************************************************