Aracılığıyla paylaş


ReportingService2005.CancelJob Yöntemi

Bir iş yürütme iptal eder.

Ad Alanı:  ReportService2005
Derleme:  ReportService2005 (ReportService2005 içinde.dll)

Sözdizimi

'Bildirim
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/CancelJob", RequestNamespace := "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices",  _
    ResponseNamespace := "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices",  _
    Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
<SoapHeaderAttribute("ServerInfoHeaderValue", Direction := SoapHeaderDirection.Out)> _
Public Function CancelJob ( _
    JobID As String _
) As Boolean
'Kullanım
Dim instance As ReportingService2005
Dim JobID As String
Dim returnValue As Boolean

returnValue = instance.CancelJob(JobID)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/CancelJob", RequestNamespace = "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)]
public bool CancelJob(
    string JobID
)
[SoapDocumentMethodAttribute(L"https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/CancelJob", RequestNamespace = L"https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    ResponseNamespace = L"https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    Use = SoapBindingUse::Literal, ParameterStyle = SoapParameterStyle::Wrapped)]
[SoapHeaderAttribute(L"ServerInfoHeaderValue", Direction = SoapHeaderDirection::Out)]
public:
bool CancelJob(
    String^ JobID
)
[<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/CancelJob", RequestNamespace = "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    ResponseNamespace = "https://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices", 
    Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)>]
[<SoapHeaderAttribute("ServerInfoHeaderValue", Direction = SoapHeaderDirection.Out)>]
member CancelJob : 
        JobID:string -> bool 
public function CancelJob(
    JobID : String
) : boolean

Parametreler

  • JobID
    Tür: System.String
    İptal etmek istediğiniz iş kimliği.iş kimliği elde etmek JobID özellik , bir Job() nesne.

Dönüş Değeri

Tür: System.Boolean
A Boole değer.Değeri, doğru döndürülmesini iş başarıyla iptal edildi.

Açıklamalar

Aşağıdaki tablo üstbilgi ve izinler bu işlemi gösterir.

soap üstbilgileri

(Giden)ServerInfoHeaderValue

Gerekli izinler

CancelJobs

iş kimliği geçirilen bir hata döndürülür JobID parametresi bulunamadı.Rapor sunucusu zaten iptal edilmiş bir iş kimliği kullanarak bu yöntem çağırın, işlem yok sayar.

Use ListJobs yöntem geçerli çalışan işlerin bir listesini elde etmek için rapor sunucusu.

Örnekler

Bu kod örneği derlemek için Raporlama Hizmetleri wsdl başvuran ve belirli ad alanları almak gerekir.Daha fazla bilgi için, bkz. Compiling and Running Code Examples.Aşağıdaki kod örneği, bir konsol uygulaması, kullanıcıların belirli rapor sunucusu üzerinde çalışan tüm işleri iptal etmek şöyledir:

Imports System
Imports System.Web.Services.Protocols

Class Sample
   Public Shared Sub Main()
      Dim rs As New ReportingService2005()
      rs.Credentials = System.Net.CredentialCache.DefaultCredentials

      Dim jobs As Job() = Nothing

      ' Return a list of current jobs.
      Try
         jobs = rs.ListJobs()

         ' Provides a prompt to cancel current jobs.
         If ListRunningJobs(jobs) Then
            Console.Write("Do you want to cancel these jobs (Y/N)?")
            Dim input As Integer = Console.Read()
            If [Char].ToLower(CChar(input)) = "y"c Then
               CancelRunningJobs(jobs, rs)
            End If
         End If
      Catch e As SoapException
         Console.WriteLine(e.Detail.InnerXml.ToString())
      End Try
   End Sub 'Main

   ' Method to send a list of current jobs and their properties
   ' to standard output.
   Public Shared Function ListRunningJobs(jobs() As Job) As Boolean
      Dim runningJobCount As Integer = 0
      Console.WriteLine("Current Jobs")
      Console.WriteLine(("================================" + Environment.NewLine))
      Dim job As Job
      For Each job In  jobs
         If job.Status = JobStatusEnum.Running Or job.Status = JobStatusEnum.New Then
            Console.WriteLine("--------------------------------")
            Console.WriteLine("JobID: {0}", job.JobID)
            Console.WriteLine("--------------------------------")
            Console.WriteLine("Action: {0}", job.Action)
            Console.WriteLine("Description: {0}", job.Description)
            Console.WriteLine("Machine: {0}", job.Machine)
            Console.WriteLine("Name: {0}", job.Name)
            Console.WriteLine("Path: {0}", job.Path)
            Console.WriteLine("StartDateTime: {0}", job.StartDateTime)
            Console.WriteLine("Status: {0}", job.Status)
            Console.WriteLine("Type: {0}", job.Type)
            Console.WriteLine("User: {0}" + Environment.NewLine, job.User)
            runningJobCount += 1
         End If
      Next job
      Console.Write("There are {0} running jobs. ", runningJobCount)
      If runningJobCount > 0 Then
         Return True
      Else
         Return False
      End If
   End Function 'ListRunningJobs

   Public Shared Sub CancelRunningJobs(jobs() As Job, rs As ReportingService)
      Try
         Dim job As Job
         For Each job In  jobs
            If job.Status = JobStatusEnum.Running Or job.Status = JobStatusEnum.New Then
               rs.CancelJob(job.JobID)
            End If
         Next job
         Console.WriteLine("All jobs successfully canceled.")
      Catch e As SoapException
         Console.WriteLine(e.Detail.InnerXml.ToString())
      End Try
   End Sub 'CancelRunningJobs
End Class 'Sample
using System;
using System.Web.Services.Protocols;

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

      Job[] jobs = null;

      // Return a list of current jobs.
      try
      {
         jobs = rs.ListJobs();

         // Provides a prompt to cancel current jobs.
         if (ListRunningJobs(jobs))
         {
            Console.Write("Do you want to cancel these jobs (Y/N)?");
            int input = Console.Read();
            if (Char.ToLower((char)input)== 'y') 
            {
               CancelRunningJobs(jobs, rs);
            }
         }
      }
      catch (SoapException e)
      {
         Console.WriteLine(e.Detail.InnerXml.ToString());
      }
   }

   // Method to send a list of current jobs and their properties
   // to standard output.
   public static bool ListRunningJobs(Job[] jobs)
   {   
      int runningJobCount = 0;
      Console.WriteLine("Current Jobs");
      Console.WriteLine("================================" + Environment.NewLine);
      foreach (Job job in jobs)
      {
         if (job.Status == JobStatusEnum.Running || 
               job.Status == JobStatusEnum.New)
         {   
            Console.WriteLine("--------------------------------");
            Console.WriteLine("JobID: {0}", job.JobID);
            Console.WriteLine("--------------------------------");
            Console.WriteLine("Action: {0}", job.Action);
            Console.WriteLine("Description: {0}", job.Description);
            Console.WriteLine("Machine: {0}", job.Machine);
            Console.WriteLine("Name: {0}", job.Name);
            Console.WriteLine("Path: {0}", job.Path);
            Console.WriteLine("StartDateTime: {0}", job.StartDateTime);
            Console.WriteLine("Status: {0}", job.Status);
            Console.WriteLine("Type: {0}", job.Type);
            Console.WriteLine("User: {0}" + Environment.NewLine, job.User);
            runningJobCount++;
         }
      }
      Console.Write("There are {0} running jobs. ", runningJobCount);
      if (runningJobCount > 0)
         return true;
      else
         return false;
   }

   public static void CancelRunningJobs(Job[] jobs, ReportingService rs)
   {   
      try
      {
         foreach (Job job in jobs)
         {
            if (job.Status == JobStatusEnum.Running || 
               job.Status == JobStatusEnum.New)
            {   
               rs.CancelJob(job.JobID);
            }
         }
         Console.WriteLine("All jobs successfully canceled.");
      }
      catch (SoapException e)
      {
         Console.WriteLine(e.Detail.InnerXml.ToString());
      }
   }
}