IFsrmReportScheduler::CreateScheduleTask method

[Starting with Windows Server 2012 this method is not supported; use the MSFT_FSRMScheduledTask WMI class to manage scheduled tasks.]

Creates a scheduled task that is used to trigger a report job.

Syntax


HRESULT CreateScheduleTask(
  [in] BSTR    taskName,
  [in] VARIANT *namespacesSafeArray,
  [in] BSTR    serializedTask
);

Parameters

taskName [in]

The name of a Task Scheduler task to create. The string is limited to 230 characters.

namespacesSafeArray [in]

A VARIANT that contains a SAFEARRAY of local directory paths to verify (see Remarks). Each element of the array is a variant of type VT_BSTR. Use the bstrVal member of the variant to set the path.

serializedTask [in]

An XML string that defines the Task Scheduler job. For details, see Task Scheduler Schema.

Return value

The method returns the following return values.

S_OK

Success

E_INVALIDARG

The taskName and serializedTask parameters cannot be NULL.

FSRM_E_ALREADY_EXISTS

The task already exists.

FSRM_E_NOT_SUPPORTED

Unable to create the scheduled task; the XML may not be valid.

FSRM_E_UNEXPECTED

An unexpected error occurred; check the application event log. You may get this error if the XML is malformed.

Remarks

To run a report job on a schedule, the value of the taskName parameter and the value of the IFsrmReportJob::Task property must be the same.

Specify the same namespaces for this method that you specified for the IFsrmReportJob::NamespaceRoots property. This method validates the namespace paths. For validation details, see the Remarks section of VerifyNamespaces.

To generate the XML, you can use the Task Scheduler v2.0 interfaces to define the scheduled task; however, the task definition must be v1.0 compatible. (Use the Task Scheduler API to define the task but not to register the task—this method registers the task.) After defining the task, access the ITaskDefinition::XmlText property to get the XML.

Note that FSRM ignores triggers in the XML that FSRM does not support. For the "MONTHLYDOW" trigger, you cannot use the V2 extensions. For example, if you specify "WeeksOfMonth", you can specify only one week of the month and it cannot be the fifth week. Also, for "DaysOfWeek", you can specify only one day.

Examples

For an example, see Scheduling a Report Job.

Requirements

Minimum supported client

None supported

Minimum supported server

Windows Server 2008

End of server support

Windows Server 2008 R2

Header

FsrmReports.h (include FsrmReports.h or FsrmTlb.h)

IDL

FsrmReports.idl

DLL

SrmSvc.dll

CLSID

CLSID_FsrmReportScheduler is defined as ea25f1b8-1b8d-4290-8ee8-e17c12c2fe20

IID

IID_IFsrmReportScheduler is defined as 6879caf9-6617-4484-8719-71c3d8645f94

See also

IFsrmReportScheduler
FsrmReportScheduler

 

 

Show: