IAdmApprovalRequestContainer

The IAdmApprovalRequestContainer interface represents the container where approval requests are stored.

Inheritance: IAdmTop

Methods

Details

GetApprovalRequests()

Returns GUIDs of all approval requests in the specified state. Each GUID is represented as an array of 16 bytes (Byte[]), and the method returns an array of byte arrays (Byte[][]).

Byte[][] GetApprovalRequests(ADM_APPROVALSTATE_ENUM requestState)

Parameters

  • requestState – the state of approval requests to return.

Examples

The following code sample outputs information about all pending approval requests.

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 the approval requests container.
$containerPath = $service.Backend.GetConfigurationContainerPath("ApprovalRequests")
$container = $service.OpenObject($containerPath.ToString(), $null, $null, 0)

# Get all pending approval requests.
$requests = $container.GetApprovalRequests("ADM_APPROVALSTATE_PENDING")

# Iterate through the requests.
foreach ($requestID in $requests)
{
    # Bind to the approval request.
    $guid = [Guid]$requestID
    $request = $service.OpenObject("Adaxes://<GUID=$guid>", $null, $null, 0)

    # Output request information.
    Write-Host "Requestor:" $request.Requestor.GetPropertyValue("name")
    Write-Host "Request Date:" $request.CreationDate.ToShortDateString()
    Write-Host "Operation:" $request.DescriptionOfOperationToApprove `n
}
C#
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.ApprovalRequests;
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 the approval requests container.
        string containerPath = service.Backend.GetConfigurationContainerPath("ApprovalRequests");
        IAdmApprovalRequestContainer container = (IAdmApprovalRequestContainer)service.OpenObject(
                containerPath, null, null, 0);

        // Get all pending approval requests.
        object[] requests = (IAdmApprovalRequest[])container.GetApprovalRequests(
            ADM_APPROVALSTATE_ENUM.ADM_APPROVALSTATE_PENDING);

        // Iterate through the requests.
        foreach (Byte[] requestId in requests)
        {
            // Bind to the approval request.
            string guid = new Guid(requestId).ToString("B");
            string requestPath = $"Adaxes://<GUID={guid}>";
            IAdmApprovalRequest request = (IAdmApprovalRequest)service.OpenObject(
                requestPath, null, null, 0);

            // Output request information.
            Console.WriteLine("Requestor: " + request.Requestor.Get("name"));
            Console.WriteLine("Request Date: " + request.CreationDate.ToShortDateString());
            Console.WriteLine("Operation: " + request.DescriptionOfOperationToApprove);
            Console.WriteLine(string.Empty);
        }
    }
}

GetApprovalRequests2()

Returns GUIDs of all approval requests in the specified state, which were created within a specific time period. Each GUID is represented as an array of 16 bytes (Byte[]), and the method returns an array of byte arrays (Byte[][]).

Byte[][] GetApprovalRequests2(ADM_APPROVALSTATE_ENUM requestState,
                              DateTime dateFrom, 
                              DateTime dateTo)

Parameters

  • requestState – the state of approval requests to return.
  • dateFrom – the start date and time of the period for which to return approval requests. The method will return only the requests created after the specified date.
  • dateTo – the end date and time of the period for which to return approval requests. The method will return only the requests created before the specified date.

GetProcessedApprovalRequests()

Returns GUIDs of all processed approval requests in the specified state, which were created within a specific time period. Each GUID is represented as an array of 16 bytes (Byte[]), and the method returns an array of byte arrays (Byte[][]).

Byte[][] GetProcessedApprovalRequests(ADM_APPROVALSTATE_ENUM requestState,
                              DateTime dateFrom, 
                              DateTime dateTo)

Parameters

  • requestState – the state of approval requests to return. If the parameter is set to ADM_APPROVALSTATE_PENDING, the method returns an empty array.
  • dateFrom – the start date and time of the period for which to return approval requests. The method will return only the requests created after the specified date.
  • dateTo – the end date and time of the period for which to return approval requests. The method will return only the requests created before the specified date.

Examples

The following code sample outputs information about all denied requests created between May 4, 2025 and June 6, 2025.

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 the approval requests container.
$containerPath = $service.Backend.GetConfigurationContainerPath("ApprovalRequests")
$container = $service.OpenObject($containerPath.ToString(), $null, $null, 0)

# Get requests denied within the specified date range.
$startDate = Get-Date "May 4, 2025"
$endDate = Get-Date "Jun 6, 2025"
$requests = $container.GetProcessedApprovalRequests("ADM_APPROVALSTATE_DENIED", $startDate, $endDate)

# Iterate through the requests.
foreach ($requestID in $requests)
{
    # Bind to the approval request.
    $guid = [Guid]$requestID
    $request = $service.OpenObject("Adaxes://<GUID=$guid>", $null, $null, 0)

    # Output request information.
    Write-Host "Requestor:" $request.Requestor.GetPropertyValue("name")
    Write-Host "Request Date:" $request.CreationDate.ToShortDateString()
    Write-Host "Operation:" $request.DescriptionOfOperationToApprove `n
}
C#
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.ApprovalRequests;
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 the approval requests container.
        string containerPath = service.Backend.GetConfigurationContainerPath("ApprovalRequests");
        IAdmApprovalRequestContainer container = (IAdmApprovalRequestContainer)service.OpenObject(
                containerPath, null, null, 0);

        // Get requests denied within the specified date range.
        DateTime startDate = DateTime.Parse("May 4, 2025");
        DateTime endDate = DateTime.Parse("Jun 6, 2025");
        object[] requests = (object[])container.GetProcessedApprovalRequests(
            ADM_APPROVALSTATE_ENUM.ADM_APPROVALSTATE_DENIED, startDate, endDate);

        // Iterate through the requests.
        foreach (Byte[] requestId in requests)
        {
            // Bind to the approval request.
            string guid = new Guid(requestId).ToString("B");
            string requestPath = $"Adaxes://<GUID={guid}>";
            IAdmApprovalRequest request = (IAdmApprovalRequest)service.OpenObject(
                requestPath, null, null, 0);

            // Output request information.
            Console.WriteLine("Requestor: " + request.Requestor.Get("name"));
            Console.WriteLine("Request Date: " + request.CreationDate.ToShortDateString());
            Console.WriteLine("Operation: " + request.DescriptionOfOperationToApprove);
            Console.WriteLine(string.Empty);
        }
    }
}

Requirements

Minimum required version: 2020.1

See also