IAdmReport
The IAdmReport interface is used to configure and generate reports.
Inheritance: IAdmTop, IAdmReportCategoryQueries, and IAdmReportPinning
Methods
-
Method
-
Description
-
Generate()
-
Initiates asynchronous generation of the report.
-
GetConfiguration()
-
Returns the IAdmReportConfiguration interface that can be used to configure the report.
-
SetConfiguration()
-
Saves the configuration of the report to the directory store.
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.
- 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 a report $reportDN = "CN=My Report,CN=Reports,CN=Reports Root,CN=Configuration Objects,"+ "CN=Adaxes Configuration,CN=Adaxes" $report = $service.OpenObject("Adaxes://$reportDN", $null, $null, 0) # Create scope for generation of the report $configuration = $report.GetConfiguration() $scope = $configuration.CreateScope("ADM_REPORTSCOPETYPE_LOCATION") $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 } }
- C#
-
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 ns = new AdmNamespace(); IAdmService service = ns.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)service.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_LOCATION); 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 int[] 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 search criteria of a report.
- 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 a report $reportDN = "CN=My report,CN=Reports,CN=Reports Root,CN=Configuration Objects,"+ "CN=Adaxes Configuration,CN=Adaxes" $report = $service.OpenObject("Adaxes://$reportDN", $null, $null, 0) # Specify new search criteria $configuration = $report.GetConfiguration() $criteria = New-AdmCriteria "group" {groupType -eq "security"} $configuration.Generator.SetCriteria($criteria) # Save the changes $report.SetConfiguration($configuration)
- C#
-
using System; using Softerra.Adaxes.Adsi; using Softerra.Adaxes.Directory.Criteria; 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 ns = new AdmNamespace(); IAdmService service = ns.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)service.OpenObject("Adaxes://" + reportDN, null, null, 0); // Build search criteria SimpleCriteriaItem groupCriteria = new() { Property = "groupType", Operator = "eq", Values = { "security" } }; Criteria criteria = new(); criteria.AddType("group", groupCriteria); // Specify new search criteria IAdmReportConfiguration configuration = report.GetConfiguration(); IAdmReportGeneratorSearch generator = (IAdmReportGeneratorSearch)configuration.Generator; generator.SetCriteria(criteria); // 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:
- bool
- Access:
- Read/Write
IsScheduledForCurrentUser
Gets a value indicating whether generation and delivery of the report is scheduled for the currently logged on user.
- Type:
- bool
- Access:
- Read-only
Requirements
Minimum required version: 2018.1