ReportingService2010.CreateCatalogItem Metodo

Definizione

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

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

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

Parent
String

L'URL completamente qualificato per la cartella genitore che conterrà l'elemento.

Overwrite
Boolean

Un'espressione Boolean che indica se un elemento esistente con lo stesso nome nella posizione specificata deve essere sovrascritto.

Definition
Byte[]

La definizione del report .rdl, la definizione del modello di report o il contenuto delle risorse da pubblicare nel server di report.

Properties
Property[]

Un array di Property oggetti che contiene i nomi delle proprietà e i valori da impostare per l'elemento.

Warnings
Warning[]

[fuori] Un array di Warning oggetti che descrive eventuali avvisi avvenuti quando l'elemento è stato validato.

Valori restituiti

Un CatalogItem oggetto per l'oggetto 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

La tabella sottostante mostra informazioni sull'intestazione e sui permessi di questa operazione.

Utilizzo dell'intestazione SOAP (Dentro) TrustedUserHeaderValue

(Fuori) ServerInfoHeaderValue
Permessi richiesti per la modalità nativa Dipende dal tipo di oggetto:

- Report
Creare un nuovo report: CreateReport sulle Parent fonti dati del report E ReadPropertiesReadProperties sui dataset del report
Aggiornamento di un report esistente: UpdateReportDefinition su (se Properties contiene proprietà) E UpdateProperties su Item E UpdateProperties sulle fonti dati del report E UpdatePropertiesItem sui dataset del report
- DataSet
Creare un nuovo dataset condiviso: CreateReport sia ReadProperties sulle Parent fonti di dati del dataset che
Aggiornamento di un dataset condiviso esistente: su E su Item (se Properties contiene proprietà) E UpdateProperties sulle fonti dati UpdateProperties del dataset ItemUpdateReportDefinition
- Resource, Component:
Creazione di un nuovo oggetto: CreateResource su Parent
Aggiornamento di un elemento esistente: UpdateContent su Item
Aggiornamento delle proprietà dell'elemento: UpdateContent E UpdateProperties su Item
- DataSource:
Creazione di una nuova fonte di dati: CreateDatasource su Parent
Aggiornamento di una fonte di dati esistente: UpdateContent
Aggiornamento delle proprietà della sorgente dati: UpdateContent E UpdateProperties
- Model: CreateModel
Permessi richiesti in modalità SharePoint Dipende dal tipo di oggetto:

- Report
Creare un nuovo report: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> su Parent E <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> su fonti di dati e dataset definiti in Definition
Aggiornamento di un report esistente: <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems> su Item E <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> su fonti di dati e dataset definiti in Definition E <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> su Item (se Properties contiene proprietà)
- DataSet
Creare un nuovo dataset condiviso: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> su Parent E <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> su fonti di dati definite in Definition
Aggiornamento di un dataset condiviso esistente: <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems> su Item E <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> su fonti dati definite in<xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems>Definitionsu Item (se Properties contiene proprietà)
- Resource, DataSource, Component:
Creazione di un nuovo oggetto: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> su Parent
Aggiornamento di un elemento esistente: <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems> su Item
- Model: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> su Parent

Questo metodo può creare elementi di tutti i tipi di elementi supportati. Per vedere quali tipi di oggetti sono supportati, usa il ListItemTypes metodo.

Il Model tipo di oggetto non può essere sovrascritto. Pertanto, il parametro Overwrite deve essere False se ItemType è Model. Altrimenti, viene lanciata un'eccezione rsInvalidParameterCombination .

Se ItemType è Report, allora i dati XML sono definiti dal Linguaggio di Definizione del Rapporto. Se ItemType è Model, allora i dati XML sono definiti dal Linguaggio di Definizione del Modello Semantico.

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

Aggiungere un elemento a un database server di report o a una libreria raccolta di SharePoint modifica le ModifiedBy proprietà e ModifiedDate della cartella genitore.

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; altrimenti, viene lanciata un'eccezione SOAP con il codice di errore rsItemLengthExceeded.

Il Parent parametro non può essere nullo o vuoto né contenere i seguenti caratteri riservati: : ? ; @ & = + $ , \ * > < | . ". Puoi usare il carattere a barra avanzata (/) per separare gli elementi nel nome completo del percorso della cartella, ma non puoi usarlo alla fine del nome della cartella.

Si applica a