次の方法で共有


ReportingService2006.CreateReport メソッド

新しいレポートを SharePoint ライブラリに追加します。

名前空間:  ReportService2006
アセンブリ:  ReportService2006 (ReportService2006.dll)

構文

'宣言
Public Function CreateReport ( _
    Report As String, _
    Parent As String, _
    Overwrite As Boolean, _
    Definition As Byte(), _
    Properties As Property(), _
    <OutAttribute> ByRef Warnings As Warning() _
) As CatalogItem
'使用
Dim instance As ReportingService2006 
Dim Report As String 
Dim Parent As String 
Dim Overwrite As Boolean 
Dim Definition As Byte()
Dim Properties As Property()
Dim Warnings As Warning()
Dim returnValue As CatalogItem 

returnValue = instance.CreateReport(Report, _
    Parent, Overwrite, Definition, Properties, _
    Warnings)
public CatalogItem CreateReport(
    string Report,
    string Parent,
    bool Overwrite,
    byte[] Definition,
    Property[] Properties,
    out Warning[] Warnings
)
public:
CatalogItem^ CreateReport(
    String^ Report, 
    String^ Parent, 
    bool Overwrite, 
    array<unsigned char>^ Definition, 
    array<Property^>^ Properties, 
    [OutAttribute] array<Warning^>^% Warnings
)
member CreateReport : 
        Report:string * 
        Parent:string * 
        Overwrite:bool * 
        Definition:byte[] * 
        Properties:Property[] * 
        Warnings:Warning[] byref -> CatalogItem
public function CreateReport(
    Report : String, 
    Parent : String, 
    Overwrite : boolean, 
    Definition : byte[], 
    Properties : Property[], 
    Warnings : Warning[]
) : CatalogItem

パラメーター

  • Report
    型: System.String
    ファイル名と .rdl ファイル名拡張子を含む、新しいレポートの名前です。
  • Parent
    型: System.String
    レポートを格納する親フォルダーの完全修飾 URL です。
  • Overwrite
    型: System.Boolean
    指定された場所に同じ名前のレポートが既に存在する場合に上書きするかどうかを示す Boolean 式です。
  • Properties
    型: array<ReportService2006.Property[]
    レポートに設定するプロパティの名前と値が格納される Property オブジェクトの配列です。
  • Warnings
    型: array<ReportService2006.Warning[]%
    [out] レポート定義の検証時に発生したすべての警告を表す Warning オブジェクトの配列です。

戻り値

型: ReportService2006.CatalogItem
新しく作成されたレポートの CatalogItem オブジェクトです。

説明

次の表に、この操作に関連するヘッダーおよび権限の情報を示します。

SOAP ヘッダー

(In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue

必要な権限

新しいレポートの作成: Parent に対する AddListItems、および Definition で定義されるデータ ソースとデータセットに対する ViewListItems

既存のレポートの更新: Report に対する EditListItems、および Definition で定義されるデータ ソースとデータセットに対する ViewListItems

Parent パラメーターの長さは、260 文字以下でなければなりません。これを超えると、エラー コード rsItemLengthExceeded の SOAP 例外がスローされます。

Parent パラメーターを NULL または空の文字列にすることはできません。また、予約文字 : ?; @ & = + $ , \ * > < | ." を含めることもできません。 スラッシュ (/) は、フォルダーの完全なパス名内の各項目を区切るために使用することはできますが、フォルダー名の末尾には使用できません。

エラーが発生すると、レポートは作成されません。

SharePoint ライブラリにレポートを追加すると、親フォルダーの ModifiedBy プロパティと ModifiedDate プロパティが変更されます。

レポート名に .rdl 拡張子を含めない場合、rsFileExtensionRequired エラーが返されます。

使用例

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;

class Sample
{
    static void Main(string[] args)
    {
        ReportingService2006 rs = new ReportingService2006();
        rs.Url = "http://<Server Name>" +
            "/_vti_bin/ReportServer/ReportService2006.asmx";
        rs.Credentials = 
            System.Net.CredentialCache.DefaultCredentials;

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

        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
        {
            string parent = "http://<Server Name>/Docs/Documents/";
            CatalogItem report = rs.CreateReport(name, parent,
                        false, definition, null, out warnings);

            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());
        }
    }
}
Imports System
Imports System.IO
Imports System.Text
Imports System.Web.Services
Imports System.Web.Services.Protocols

Class Sample

    Public Shared Sub Main()

        Dim rs As New ReportingService2006()
        rs.Url = "http://<Server Name>" + _
            "/_vti_bin/ReportServer/ReportService2006.asmx"
        rs.Credentials = _
            System.Net.CredentialCache.DefaultCredentials

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

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

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

        Try
            Dim parentPath As String = _
                "http://<Server Name>/Docs/Documents/"
            rs.CreateReport(name, parentPath, False, _
                definition, Nothing, warnings)

            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

End Class

関連項目

参照

ReportingService2006 クラス

ReportService2006 名前空間