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 MERCHANTBILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
'
' IF YOU WANT THIS FUNCTIONALITY TO BE CONDITIONALLY SUPPORTED,
' PLEASE CONTACT QUEST PROFESSIONAL SERVICES.
'*********************************************************************************
'
' This code is published on the ActiveRoles Script Center:
' http://communities.quest.com/docs/DOC-9991
'
' This code may use functions from the ARS Script Policy Best Practices:
' http://communities.quest.com/docs/DOC-10016
'
' Please, follow the link to obtain instructions and code for those functions.
'*********************************************************************************
//----- 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 ***************************************************************
COMPATIBILITY
Code compatible with the following version(s): <Not specified>