ReportingService2005.CreateReport メソッド

定義

新しいレポートをレポートサーバーデータベースに追加します。

public:
 cli::array <ReportService2005::Warning ^> ^ CreateReport(System::String ^ Report, System::String ^ Parent, bool Overwrite, cli::array <System::Byte> ^ Definition, cli::array <ReportService2005::Property ^> ^ Properties);
public ReportService2005.Warning[] CreateReport(string Report, string Parent, bool Overwrite, byte[] Definition, ReportService2005.Property[] Properties);
member this.CreateReport : string * string * bool * byte[] * ReportService2005.Property[] -> ReportService2005.Warning[]
Public Function CreateReport (Report As String, Parent As String, Overwrite As Boolean, Definition As Byte(), Properties As Property()) As Warning()

パラメーター

Report
String

新しい報告書の名前です。

Parent
String

レポートを追加する親フォルダの完全限定URLです。

Overwrite
Boolean

指定された場所で同じ名前の既存レポートを上書きすべきかどうかを示す Boolean 式。

Definition
Byte[]

レポートの定義はレポートサーバーに公開するもので、.rdlファイルの内容です。 XMLデータは http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition/ レポート定義言語によって定義されます。

Properties
Property[]

レポートに設定するプロパティ名や値を含む Property オブジェクトの配列です。

返品

レポート定義が検証された際に発生した警告を記述する Warning オブジェクトの配列です。

このコード例をコンパイルするには、Reporting Services WSDLを参照し、特定の名前空間をインポートする必要があります。 詳細については 、「コード例のコンパイルと実行」をご覧ください。 以下のコード例は、レポート定義言語(RDL)ファイルの形でレポートサーバーのデータベースに公開します。

Imports System  
Imports System.IO  
Imports System.Web.Services.Protocols  

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

      Dim definition As [Byte]() = Nothing  
      Dim warnings As Warning() = Nothing  
      Dim name As String = "MyReport"  

      Try  
         Dim stream As FileStream = File.OpenRead("MyReport.rdl")  
         definition = New [Byte](stream.Length - 1) {}  
         stream.Read(definition, 0, CInt(stream.Length - 1))  
         stream.Close()  

      Catch e As IOException  
         Console.WriteLine(e.Message)  
      End Try  

      Try  
         warnings = rs.CreateReport(name, "/Samples", False, definition, Nothing)  

         If Not (warnings Is Nothing) Then  
            Dim warning As Warning  
            For Each warning In  warnings  
               Console.WriteLine(warning.Message)  
            Next warning  

         Else  
            Console.WriteLine("Report: {0} created successfully with no warnings", name)  
         End If  

      Catch e As SoapException  
         Console.WriteLine(e.Detail.InnerXml.ToString())  
      End Try  
   End Sub 'Main   
End Class 'Sample  
using System;  
using System.IO;  
using System.Web.Services.Protocols;  

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

      Byte[] definition = null;  
      Warning[] warnings = null;  
      string name = "MyReport";  

      try  
      {  
         FileStream stream = File.OpenRead("MyReport.rdl");  
         definition = new Byte[stream.Length];  
         stream.Read(definition, 0, (int) stream.Length);  
         stream.Close();  
      }  

      catch(IOException e)  
      {  
         Console.WriteLine(e.Message);  
      }  

      try  
      {  
         warnings = rs.CreateReport(name, "/Samples", false, definition, null);  

         if (warnings != null)  
         {  
            foreach (Warning warning in warnings)  
            {  
               Console.WriteLine(warning.Message);  
            }  
         }  

         else  
            Console.WriteLine("Report: {0} created successfully with no warnings", name);  
      }  

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

   }  
}  

注釈

以下の表は、この操作のヘッダーおよび権限情報を示しています。

SOAPヘッダー (イン) BatchHeaderValue

(アウト) ServerInfoHeaderValue
必要なアクセス許可 新しいレポートを作成する方法:Parentとレポートのデータソース、そしてデータセットのReadPropertiesReadPropertiesCreateReport

既存レポートの更新:ReportReport(Propertiesにプロパティが含まれている場合)UpdatePropertiesUpdateReportDefinition、レポートのデータソースとデータセットのUpdatePropertiesUpdateProperties

Parentパラメータの長さは260文字を超えてはなりません。そうでなければ、エラーコードrsItemLengthExceedでSOAP例外が発生します。

Parentパラメータはnullや空であってはならず、以下の保留文字を含むことはできません:: ? ; @ & = + $ , \ * > < | . "。 フォルダーのフルパス名の項目を区切るためにスラッシュ文字(/)を使うことはできますが、フォルダ名の最後に使うことはできません。

エラーが発生した場合、レポートは作成されません。

レポートサーバーデータベースにレポートを追加すると、親フォルダの ModifiedBy および ModifiedDate プロパティが変更されます。

適用対象