Click or drag to resize

ReportOperationsReport Method

Run a report.

Namespace:  Cobra.WebService.ClientAPI.Application.Reporting
Assembly:  Cobra.WebService.ClientAPI (in Cobra.WebService.ClientAPI.dll) Version: 8.4.717.3176 (8.4.0717.3176)
Syntax
C#
public ServiceResult Report(
	ReportServiceArguments reportServiceArguments
)

Parameters

reportServiceArguments
Type: Cobra.Model.WebServiceReportServiceArguments
An instance of ReportServiceArguments class that contains the options to run the Calculate Progress.

Return Value

Type: ServiceResult
The result of running a report.
Exceptions
ExceptionCondition
InvalidOperationExceptionThrown when state of the instance of the CobraServices that generated the current ReportOperations is not in opened state.
Examples
This sample shows how to run a report.
C#
using Cobra.WebService.ClientAPI;
using Cobra.WebService.ClientAPI.Client;
using Cobra.WebService.ClientAPI.Application.Files;

.
.
.

CobraServices cobraServices = new CobraServices();
cobraServices.ServiceIdentityData.Username = "SYSADMIN";
cobraServices.ServiceIdentityData.SecurePassword = new SecurePassword();
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('P');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('A');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('S');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('S');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('W');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('O');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('R');
cobraServices.ServiceIdentityData.SecurePassword.AppendChar('D');
cobraServices.ServiceIdentityData.DataSourceKey = "COBRA";

LoginResult loginResult = cobraServices.Login();
if (!loginResult.Success) {
    Console.WriteLine("Login failed.");
    return;
}

Console.WriteLine("Login Success.");

ReportOperations reportOperations = cobraServices.CreateServiceOperations<ReportOperations>();
ReportServiceArguments reportServiceArguments = reportOperations.CreateReportOperationsServiceArguments<ReportServiceArguments>();
reportServiceArguments.ReportId = "CAP";
reportServiceArguments.FileId = "Demo Advanced";
reportServiceArguments.OutputFilename = "C:\Temp\Myreport.xlsx";
reportServiceArguments.OwnerId = "SYSADMIN";

Console.WriteLine("Running Report...");
ServiceResult reportResult = reportOperations.Report(reportServiceArguments);
if (reportResult.Success)
    Console.WriteLine("Report completed successfully.");
else
    Console.WriteLine("Report did not complete successfully.");

cobraServices.LogOut();
See Also