Skip to content

IAdmReport

The IAdmReport interface is used to configure and generate reports.

Inheritance: The IAdmReport interface inherits from the IAdmTop, IAdmReportCategoryQueries, and IAdmReportPinning interfaces.

Methods

Properties

  • Property

  • Description

  • ReportName

  • Gets or sets a name of the report.

  • ReportId

  • Gets the unique immutable identifier of the report.

  • Disabled

  • Gets or sets a value indicating whether the report is disabled.

  • IsScheduledForCurrentUser

  • Gets a value indicating whether generation and delivery of the report is scheduled for the currently logged on user.

Details

Generate()

Initiates asynchronous generation of the report. Returns the IAdmListItems interface that can be used to iterate through report items, fetch column values, etc.

IAdmListItems Generate(IAdmReportArguments arguments)

Parameters

The arguments parameter specifies arguments for generation of the report.

Examples

The following code sample generates a report and outputs report items.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to a report
$reportDN = "CN=My Report,CN=Reports,CN=Reports Root,CN=Configuration Objects,"+
    "CN=Adaxes Configuration,CN=Adaxes"
$report = $admService.OpenObject("Adaxes://$reportDN", $NULL, $NULL, 0)

# Create scope for generation of the report
$configuration = $report.GetConfiguration()
$scope = $configuration.CreateScope("ADM_REPORTSCOPETYPE_ADLOCATION")
$baseObject = $scope.CreateBaseObject()
$objReference = New-Object "Softerra.Adaxes.Adsi.AdmObjectReference"
$objReference.ObjectDN = "OU=Sales,DC=example,DC=com"
$baseObject.ObjectReference = $objReference
$scope.BaseObjects = @($baseObject)

# Specify arguments for generation of the report
$arguments = $configuration.CreateReportArguments()
$arguments.Scope = $scope
$arguments.Columns = @("cn","description")
$arguments.SetParameterValue("MyParameter","30")

# Generate report
$listItems = $report.Generate($arguments)

while ($True)
{
    # Get report item IDs 
    $listItemsIds = $listItems.GetNextIDs(10)

    # Check whether report generation is completed
    if ($listItemsIds -eq $NULL)
    {
        break
    }

    # Wait 100 milliseconds if items were not fetched
    if ($listItemsIds.Length -eq 0)
    {
        Sleep -Milliseconds 100
        continue
    }

    # Get column values
    $searchResults = $listItems.GetColumnValues($listItemsIds, $arguments.Columns)

    # Output report items
    foreach ($searchResult in $searchResults)
    {
        Write-Host "Full name:" $searchResult.GetPropertyByName("cn").Value
        Write-Host "Description:" $searchResult.GetPropertyByName("description").Value
    }
}
using System;
using System.Threading;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.ListItems;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;
using Softerra.Adaxes.Interop.Adsi.Reports;

class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Bind to a report
        const String reportDN = "CN=My Report,CN=Reports,CN=Reports Root,CN=Configuration Objects," +
                                "CN=Adaxes Configuration,CN=Adaxes";
        IAdmReport report =
            (IAdmReport)admService.OpenObject("Adaxes://" + reportDN, null, null, 0);

        // Create scope for generation of the report
        IAdmReportConfiguration configuration = report.GetConfiguration();
        IAdmReportScope scope = configuration.CreateScope(
            ADM_REPORTSCOPETYPE_ENUM.ADM_REPORTSCOPETYPE_ADLOCATION);
        IAdmReportPredefinedObject baseObject = scope.CreateBaseObject();
        IAdmObjectReference objReference = new AdmObjectReference();
        objReference.ObjectDN = "OU=Sales,DC=example,DC=com";
        baseObject.ObjectReference = objReference;
        scope.BaseObjects = new[] { baseObject };

        // Specify arguments for generation of the report
        IAdmReportArguments arguments = configuration.CreateReportArguments();
        arguments.Scope = scope;
        arguments.Columns = new Object[] { "cn", "description" };
        arguments.SetParameterValue("param-MyParameter", "30");

        // Generate report
        IAdmListItems listItems = report.Generate(arguments);

        while (true)
        {
            // Get report item IDs
            Int32[] listItemsIds = listItems.GetNextIDs(10);

            // Check whether report generation is completed
            if (listItemsIds == null)
            {
                break;
            }

            // Wait 100 milliseconds if items were not fetched
            if (listItemsIds.Length == 0)
            {
                Thread.Sleep(100);
                continue;
            }

            // Get column values
            IAdmSearchResult[] searchResults = listItems.GetColumnValues(listItemsIds,
                arguments.Columns);

            // Output report items
            foreach (IAdmSearchResult searchResult in searchResults)
            {
                IAdmSearchResultProperty fullNameProperty = searchResult.GetPropertyByName("cn");
                Object[] fullNamePropertyValues = (Object[])fullNameProperty.Values;
                Console.WriteLine("Full name: {0}", fullNamePropertyValues[0]);

                IAdmSearchResultProperty descriptionProperty = searchResult.GetPropertyByName("description");
                Object[] descriptionPropertyValues = (Object[])descriptionProperty.Values;
                Console.WriteLine("Description: {0}", descriptionPropertyValues[0]);
            }
        }
    }
}

GetConfiguration()

Returns the IAdmReportConfiguration interface that can be used to configure the report.

IAdmReportConfiguration GetConfiguration()

Remarks

To save configuration of a report, use the SetConfiguration method.


SetConfiguration()

Saves the configuration of the report to the directory store.

void SetConfiguration(IAdmReportConfiguration configuration)

Parameters

The configuration parameter specifies the configuration of the report to save.

Remarks

To retrieve configuration of a report, use the GetConfiguration method.

Examples

The following code sample updates the LDAP search filter of a report.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to a report
$reportDN = "CN=My report,CN=Reports,CN=Reports Root,CN=Configuration Objects,"+
"CN=Adaxes Configuration,CN=Adaxes"
$report = $admService.OpenObject("Adaxes://$reportDN", $NULL, $NULL, 0)

# Specify new LDAP search filter
$configuration = $report.GetConfiguration()
$configuration.Generator.LdapSearchFilter = "(&(objectClass=group)(department=Sales))"

# Save the changes
$report.SetConfiguration($configuration)
using System;
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;
using Softerra.Adaxes.Interop.Adsi.Reports;

class Program
{
    static void Main(string[] args)
    {
        // Connect to the Adaxes service
        AdmNamespace adsNS = new AdmNamespace();
        IAdmService admService = adsNS.GetServiceDirectly("localhost");

        // Bind to a report
        const String reportDN = "CN=My Report,CN=Reports,CN=Reports Root,CN=Configuration Objects," +
                                "CN=Adaxes Configuration,CN=Adaxes";
        IAdmReport report =
            (IAdmReport)admService.OpenObject("Adaxes://" + reportDN, null, null, 0);

        // Specify new LDAP search filter
        IAdmReportConfiguration configuration = report.GetConfiguration();
        IAdmReportGeneratorADSearch generator = (IAdmReportGeneratorADSearch)configuration.Generator;
        generator.LdapSearchFilter = "(&(objectClass=group)(department=Sales))";

        // Save the changes
        report.SetConfiguration(configuration);
    }
}

ReportName

Gets or sets a name of the report.

  • Type:
  • String
  • Access:
  • Read/Write

ReportId

Gets the unique immutable identifier of the report.

  • Type:
  • String
  • Access:
  • Read-only

Remarks

The identifier does not change if you backup and restore Adaxes service configuration.


Disabled

Gets or sets a value indicating whether the report is disabled.

  • Type:
  • Boolean
  • Access:
  • Read/Write

IsScheduledForCurrentUser

Gets a value indicating whether generation and delivery of the report is scheduled for the currently logged on user.

  • Type:
  • Boolean
  • Access:
  • Read-only

Requirements

Minimum required version: 2018.1

See also