ReportingService2010.CreateCatalogItem Metodo

Definizione

Aggiunge un nuovo elemento a un database del server di report o alla raccolta di SharePoint. Questo metodo si applica ai tipi di elemento Report, Model, Dataset, Component, Resource e DataSource.

public:
 ReportService2010::CatalogItem ^ CreateCatalogItem(System::String ^ ItemType, System::String ^ Name, System::String ^ Parent, bool Overwrite, cli::array <System::Byte> ^ Definition, cli::array <ReportService2010::Property ^> ^ Properties, [Runtime::InteropServices::Out] cli::array <ReportService2010::Warning ^> ^ % Warnings);
[System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateCatalogItem", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, RequestNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", ResponseNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[System.Web.Services.Protocols.SoapHeader("TrustedUserHeaderValue")]
[System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)]
public ReportService2010.CatalogItem CreateCatalogItem (string ItemType, string Name, string Parent, bool Overwrite, byte[] Definition, ReportService2010.Property[] Properties, out ReportService2010.Warning[] Warnings);
[<System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateCatalogItem", ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped, RequestNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", ResponseNamespace="http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer", Use=System.Web.Services.Description.SoapBindingUse.Literal)>]
[<System.Web.Services.Protocols.SoapHeader("TrustedUserHeaderValue")>]
[<System.Web.Services.Protocols.SoapHeader("ServerInfoHeaderValue", Direction=System.Web.Services.Protocols.SoapHeaderDirection.Out)>]
member this.CreateCatalogItem : string * string * string * bool * byte[] * ReportService2010.Property[] * Warning[] -> ReportService2010.CatalogItem
Public Function CreateCatalogItem (ItemType As String, Name As String, Parent As String, Overwrite As Boolean, Definition As Byte(), Properties As Property(), ByRef Warnings As Warning()) As CatalogItem

Parametri

ItemType
String

Tipo di elemento.

Name
String

Nome del nuovo elemento, inclusa l'estensione file in modalità SharePoint.

Parent
String

URL completo della cartella padre che conterrà l'elemento.

Overwrite
Boolean

Un'espressione Boolean che indica se è necessario sovrascrivere un elemento esistente con lo stesso nome nel percorso specificato.

Definition
Byte[]

La definizione del report rdl, la definizione del modello di report o il contenuto della risorsa da pubblicare sul server di report.

Properties
Property[]

Matrice di oggetti Property contenente i nomi e i valori delle proprietà da impostare per l'elemento.

Warnings
Warning[]

[out] Matrice di oggetti Warning che descrive gli avvisi generati durante la convalida dell'elemento.

Restituisce

Oggetto CatalogItem per l'elemento appena creato.

Attributi

Esempio

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)  
    {  
        ReportingService2010 rs = new ReportingService2010();  
        rs.Url = "http://<Server Name>" +  
            "/_vti_bin/ReportServer/ReportService2010.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.CreateCatalogItem("Report", 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 ReportingService2010()  
        rs.Url = "http://<Server Name>" + _  
            "/_vti_bin/ReportServer/ReportService2010.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.CreateCatalogItem("Report", 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  

Commenti

Nella tabella seguente vengono mostrate le informazioni sull'intestazione e sulle autorizzazioni relative a questa operazione.

Utilizzo intestazione SOAP (In) TrustedUserHeaderValue

(Out) ServerInfoHeaderValue
Autorizzazioni necessarie per la modalità nativa Dipende dal tipo di elemento:

- Report
Creazione di un nuovo report: CreateReport su Parent AND ReadProperties sulle origini dati del report E ReadProperties sui set di dati del report
Aggiornamento di un report esistente: UpdateReportDefinition su (se Properties contiene proprietà) AND UpdateProperties su Item AND UpdateProperties nelle origini dati del report AND UpdateProperties nei set Item di dati del report
- DataSet
Creazione di un nuovo set di dati condiviso: CreateReport in Parent AND ReadProperties nelle origini dati del set di dati
Aggiornamento di un set di dati condiviso esistente: in AND in Item (se Properties contiene proprietà) AND UpdateProperties nelle origini dati del set UpdateProperties di dati ItemUpdateReportDefinition
- Resource, Component:
Creazione di un nuovo elemento: CreateResource on Parent
Aggiornamento di un elemento esistente: UpdateContent in Item
Aggiornamento delle proprietà dell'elemento: UpdateContent AND UpdateProperties in Item
- DataSource:
Creazione di una nuova origine dati: CreateDatasource in Parent
Aggiornamento di un'origine dati esistente: UpdateContent
Aggiornamento delle proprietà dell'origine dati: UpdateContent AND UpdateProperties
- Model: CreateModel
Autorizzazioni necessarie per la modalità SharePoint Dipende dal tipo di elemento:

- Report
Creazione di un nuovo report: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> su Parent AND <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> in origini dati e set di dati definiti in Definition
Aggiornamento di un report esistente: <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems> su Item AND <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> su origini dati e set di dati definiti in AND <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> su DefinitionItem (se Properties contiene proprietà)
- DataSet
Creazione di un nuovo set di dati condiviso: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> in Parent AND <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> nelle origini dati definite in Definition
Aggiornamento di un set di dati condiviso esistente: in AND nelle origini dati definite in<xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems>ItemDefinition(se Properties contiene proprietà)<xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems>Item<xref:Microsoft.SharePoint.SPBasePermissions.EditListItems>
- Resource, DataSource, Component:
Creazione di un nuovo elemento: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> on Parent
Aggiornamento di un elemento esistente: <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems> in Item
- Model: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> on Parent

Questo metodo può creare elementi di tutti i tipi di elementi supportati. Per visualizzare i tipi di elemento supportati, usare il ListItemTypes metodo .

Impossibile sovrascrivere il Model tipo di elemento. Pertanto, il Overwrite parametro deve essere False se ItemType è Model. In caso contrario, viene generata un'eccezione rsInvalidParameterCombination .

Se ItemType è Report, i dati XML vengono definiti dal linguaggio di definizione del report. Se ItemType è Model, i dati XML vengono definiti dal linguaggio di definizione del modello semantico.

Se si verificano errori, l'elemento non viene creato.

L'aggiunta di un elemento a un database del server di report o a una raccolta di SharePoint modifica le ModifiedBy proprietà e ModifiedDate della cartella padre.

Se l'estensione del nome file applicabile ,ad esempio rdl, viene esclusa dal nome dell'elemento, verrà restituito un rsFileExtensionRequired errore.

La lunghezza del Parent parametro non può superare i 260 caratteri. In caso contrario, viene generata un'eccezione SOAP con il codice di errore rsItemLengthExceeded.

Il Parent parametro non può essere null o vuoto o contenere i caratteri riservati seguenti: : ? ; @ & = + $ , \ * > < | . ". È possibile utilizzare il carattere barra (/) per separare gli elementi nel nome completo del percorso della cartella, ma non è possibile usarlo alla fine del nome della cartella.

Si applica a