ReportingService2005.SetExecutionOptions(String, ExecutionSettingEnum, ScheduleDefinitionOrReference) Method


为指定的报表设置执行选项和关联的执行属性。Sets execution options and associated execution properties for a specified report.

 void SetExecutionOptions(System::String ^ Report, ReportService2005::ExecutionSettingEnum ExecutionSetting, ReportService2005::ScheduleDefinitionOrReference ^ Item);
public void SetExecutionOptions (string Report, ReportService2005.ExecutionSettingEnum ExecutionSetting, ReportService2005.ScheduleDefinitionOrReference Item);
member this.SetExecutionOptions : string * ReportService2005.ExecutionSettingEnum * ReportService2005.ScheduleDefinitionOrReference -> unit
Public Sub SetExecutionOptions (Report As String, ExecutionSetting As ExecutionSettingEnum, Item As ScheduleDefinitionOrReference)



报表的完整路径名。The full path name of the report.


说明报表何时执行的 ExecutionSettingEnum 值之一。One of the ExecutionSettingEnum values that describe when the report executes. 值可以是 LiveSnapshotThe value can be either Live or Snapshot.


计划定义或共享计划(ScheduleDefinitionOrReference 对象),报表服务器用其来执行计划中的报表。The schedule definition or shared schedule (ScheduleDefinitionOrReference object) that the report server uses to execute a report on a schedule.


若要编译下面的代码示例,必须引用 Reporting Services WSDL 并导入某些命名空间。To compile the following code example, you must reference the Reporting Services WSDL and import certain namespaces. 有关详细信息,请参阅 编译和运行代码示例For more information, see Compiling and Running Code Examples. 下面的代码示例使用 SetExecutionOptions 方法将 "公司销售" 报表的选项设置为按计划作为快照运行:The following code example uses the SetExecutionOptions method to set the options for the Company Sales report to run as a snapshot on a schedule:

using System;  
using System.Web.Services.Protocols;  

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

      ScheduleDefinition definition = new ScheduleDefinition();  

      // Create the schedule definition.  
      definition.StartDateTime = new DateTime( 2003, 2, 22, 10, 15, 0 );  
      MinuteRecurrence recurrence = new MinuteRecurrence();  
      recurrence.MinutesInterval = 60;  
      definition.Item = recurrence;  

      // Apply execution settings  
         rs.SetExecutionOptions("/SampleReports/Company Sales", ExecutionSettingEnum.Snapshot, definition);  

      catch (SoapException ex)  


下表显示了有关此操作的标头和权限信息。The table below shows header and permissions information on this operation.

SOAP 标头SOAP Headers (In) BatchHeaderValue(In) BatchHeaderValue

(Out) ServerInfoHeaderValue(Out) ServerInfoHeaderValue
所需的权限Required Permissions UpdatePolicy

Item仅当参数的值为时,参数才有效 ExecutionSetting SnapshotThe Item parameter is valid only if the value of the ExecutionSetting parameter is Snapshot. 如果设置为,则将的值设置 Itemnull Nothing Visual Basic) 中 (ExecutionSetting LiveSet the value of Item to null (Nothing in Visual Basic) if ExecutionSetting is set to Live. 如果使用的是共享计划,请将的值设置 ItemScheduleReference 引用现有共享计划的对象。If you are using a shared schedule, set the value of Item to a ScheduleReference object that references an existing shared schedule. 如果要定义唯一计划,请将的值设置 ItemScheduleDefinition 定义唯一计划的对象。If you are defining a unique schedule, set the value of Item to the ScheduleDefinition object that defines a unique schedule. 如果报表的执行选项基于共享计划并删除共享计划,则该计划将与单独的报表关联。If the execution options for a report are based on a shared schedule and that shared schedule is deleted, the schedule is then associated with the individual report.

如果将的值从更改 ExecutionSetting Live 为,则将 Snapshot 从缓存中删除报表。If you change the value of ExecutionSetting from Live to Snapshot, the report is removed from the cache.

Applies to