Expand Minimize
0 out of 1 rated this helpful - Rate this topic

CreateSchedule Method

SQL Server 2000

ReportingService.CreateSchedule Method

Creates a new shared schedule.

Public Function CreateSchedule( _
   ByVal Name As String, _
   ByVal ScheduleDefinition As [Namespace].ScheduleDefinition _
) As String
   Member of [Namespace].ReportingService
public string CreateSchedule(
   string Name,
   [Namespace].ScheduleDefinition ScheduleDefinition
);
   Member of [Namespace].ReportingService
Parameters
Name
The name of the schedule.
ScheduleDefinition
A ScheduleDefintion[] object that defines the properties and values for the schedule.
Return Value

A string value representing the ID of the newly-created schedule.

Permissions

Operation Description
Create Schedules Required for creating a new shared schedule.

Remarks

If an error occurs when the CreateSchedule method executes, the schedule is not created and no schedule ID is returned.

Example

To compile this code example, you must reference the Reporting Services WSDL and import certain namespaces. For more information, see Compiling and Running Code Examples. The following code example creates a shared schedule in the report server database that runs every weekday at 2:00 P.M., starting March 3, 2003:

Imports System
Imports System.Web.Services.Protocols

Class Sample
   Public Shared Sub Main()
      Dim rs As New ReportingService()
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials
      
      Dim definition As New ScheduleDefinition()
      Dim scheduleID As String = ""
      
      ' Create the schedule definition.
      definition.StartDateTime = New DateTime(2003, 3, 1, 14, 0, 0)
      Dim recurrence As New WeeklyRecurrence()
      Dim days As New DaysOfWeekSelector()
      days.Monday = True
      days.Tuesday = True
      days.Wednesday = True
      days.Thursday = True
      days.Friday = True
      days.Saturday = False
      days.Sunday = False
      recurrence.DaysOfWeek = days
      recurrence.WeeksInterval = 1
      recurrence.WeeksIntervalSpecified = True
      definition.Item = recurrence
      
      Try
         scheduleID = rs.CreateSchedule("My Schedule", definition)
         Console.WriteLine("Schedule created with ID {0}", scheduleID)
      
      Catch e As SoapException
         Console.WriteLine(e.Detail.InnerXml.ToString())
      End Try
   End Sub 'Main
End Class 'Sample
using System;
using System.Web.Services.Protocols;

class Sample
{
   public static void Main()
   {
      ReportingService rs = new ReportingService();
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

      ScheduleDefinition definition = new ScheduleDefinition();
      string scheduleID = "";

      // Create the schedule definition.
      definition.StartDateTime = new DateTime(2003, 3, 1, 14, 0, 0);
      WeeklyRecurrence recurrence = new WeeklyRecurrence();
      DaysOfWeekSelector days = new DaysOfWeekSelector();
      days.Monday = true;
      days.Tuesday = true;
      days.Wednesday = true;
      days.Thursday = true;
      days.Friday = true;
      days.Saturday = false;
      days.Sunday = false;
      recurrence.DaysOfWeek = days;
      recurrence.WeeksInterval = 1;
      recurrence.WeeksIntervalSpecified = true;
      definition.Item = recurrence;

      try
      {
         scheduleID = rs.CreateSchedule("My Schedule", definition);
         Console.WriteLine("Schedule created with ID {0}", scheduleID);
      }

      catch ( SoapException e )
      {
         Console.WriteLine(e.Detail.InnerXml.ToString());
      }
   }
}
See Also

ReportingService Class

Reporting Services Web Service Library

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.