IAdmReportScheduledTask

The IAdmReportScheduledTask interface represents a scheduled task used to generate and deliver reports.

Inheritance: IAdmScheduledTask

Methods

Properties

  • Property

  • Description

  • ScheduledReports

  • Gets a collection of reports scheduled by the task.

  • AllowForSelfScheduling

  • Gets or sets a value indicating whether users can schedule reports for themselves using the task.

Details

CreateReportData()

Creates an instance of the IAdmScheduledReportData interface used to specify parameters for report generation and delivery on schedule.

IAdmScheduledReportData CreateReportData()

Examples

The following code sample adds a report to a scheduled task.

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 scheduled task
$scheduledTaskDN = "CN=MyTask,CN=Report Schedule,CN=Reports Root,CN=Configuration Objects,"+
    "CN=Adaxes Configuration,CN=Adaxes"
$scheduledTask = $service.OpenObject("Adaxes://$scheduledTaskDN", $null, $null, 0)

# Specify parameters for report generation and configure delivery options
$scheduledReportData = $scheduledTask.CreateReportData()
$reportDN = "CN=MyReport,CN=Reports,CN=Reports Root,CN=Configuration Objects,"+
    "CN=Adaxes Configuration,CN=Adaxes"
$report = $service.OpenObject("Adaxes://$reportDN", $null, $null, 0)
$scheduledReportData.Report = $report
$reportDocument = $scheduledReportData.CreateDocument("ADM_REPORTDOCUMENTTYPE_PDF")
$reportDocument.Content = "ADM_REPORTDOCUMENTCONTENT_TABLE"
$scheduledReportData.Document = $reportDocument
$scheduledReportData.Delivery.EmailDelivery.Enabled = $true
$scheduledReportData.Delivery.EmailDelivery.AttachFile = $true

# Create scheduled task item
$scheduledTaskItem = $scheduledTask.ScheduledReports.Create()
$scheduledTaskItem.ReportData = $scheduledReportData
$scheduledTaskItem.SetInfo()

# Specify recipients
$userDN = "CN=John Smith,OU=Users,DC=company,DC=com"
$user = $service.OpenObject("Adaxes://$userDN", $null, $null, 0)
$recipient = $scheduledTaskItem.ActivityScopeItems.Create()
$recipient.BaseObject = $user
$recipient.Exclude = $false
$recipient.Inheritance = "ADS_SCOPE_BASE"
$recipient.Type = "ADM_SCOPEBASEOBJECTTYPE_CONTAINER"
$recipient.SetInfo()
$scheduledTaskItem.ActivityScopeItems.Add($recipient)

# Add the report to the scheduled task
$scheduledTask.ScheduledReports.Add($scheduledTaskItem)
C#
using Softerra.Adaxes.Adsi;
using Softerra.Adaxes.Interop.Adsi;
using Softerra.Adaxes.Interop.Adsi.PersistentObjects;
using Softerra.Adaxes.Interop.Adsi.Reports;
using Softerra.Adaxes.Interop.Adsi.Reports.Document;
using Softerra.Adaxes.Interop.Adsi.Reports.Schedule;

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

        // Bind to a scheduled task
        const string scheduledTaskPath = "Adaxes://CN=MyTask,CN=Report Schedule,CN=Reports Root," +
                                        "CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes";
        IAdmReportScheduledTask scheduledTask = 
            (IAdmReportScheduledTask)service.OpenObject(scheduledTaskPath, null, null, 0);

        // Specify parameters for report generation and configure delivery options
        IAdmScheduledReportData scheduledReportData = scheduledTask.CreateReportData();
        const string reportPath = "Adaxes://CN=MyReport,CN=Reports,CN=Reports Root," +
                                "CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes";
        IAdmReport report = (IAdmReport)service.OpenObject(reportPath, null, null, 0);
        scheduledReportData.Report = report;
        IAdmReportDocumentExtended reportDocument = 
            (IAdmReportDocumentExtended)scheduledReportData.CreateDocument(
            ADM_REPORTDOCUMENTTYPE_ENUM.ADM_REPORTDOCUMENTTYPE_PDF);
        reportDocument.Content = ADM_REPORTDOCUMENTCONTENT_ENUM.ADM_REPORTDOCUMENTCONTENT_TABLE;
        scheduledReportData.Document = reportDocument;
        scheduledReportData.Delivery.EmailDelivery.Enabled = true;
        scheduledReportData.Delivery.EmailDelivery.AttachFile = true;

        // Create scheduled task item
        IAdmScheduledReportItem scheduledTaskItem = 
            (IAdmScheduledReportItem)scheduledTask.ScheduledReports.Create();
        scheduledTaskItem.ReportData = scheduledReportData;
        scheduledTaskItem.SetInfo();

        // Specify recipients
        const string userPath = "Adaxes://CN=John Smith,OU=Users,DC=company,DC=com";
        IAdmTop user = (IAdmTop)service.OpenObject(userPath, null, null, 0);
        IAdmActivityScopeItem recipient = 
            (IAdmActivityScopeItem)scheduledTaskItem.ActivityScopeItems.Create();
        recipient.BaseObject = user;
        recipient.Exclude = false;
        recipient.Inheritance = ADS_SCOPEENUM.ADS_SCOPE_BASE;
        recipient.Type = ADM_SCOPEBASEOBJECTTYPE_ENUM.ADM_SCOPEBASEOBJECTTYPE_CONTAINER;
        recipient.SetInfo();
        scheduledTaskItem.ActivityScopeItems.Add(recipient);

        // Add the report to the scheduled task
        scheduledTask.ScheduledReports.Add(scheduledTaskItem);
    }
}

ScheduledReports

Gets a collection of reports scheduled by the task. Each report in the collection is represented by the IAdmScheduledReportItem interface.


AllowForSelfScheduling

Gets or sets a value indicating whether users can schedule reports for themselves using the task.

  • Type:
  • bool
  • Access:
  • Read/Write

Requirements

Minimum required version: 2018.1

See also