ReportingService2005.CreateReport Metodo
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Aggiunge un nuovo report al database del server di report.
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()
Parametri
- Report
- String
Il nome del nuovo rapporto.
- Parent
- String
L'URL completamente qualificato della cartella genitore a cui aggiungere il report.
- Overwrite
- Boolean
Un'espressione Boolean che indica se un report esistente con lo stesso nome nella posizione specificata deve essere sovrascritto.
- Definition
- Byte[]
La definizione del report da pubblicare al server di report, che è il contenuto di un file .rdl. I dati XML sono definiti dal http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition/ Linguaggio di Definizione del Report .
- Properties
- Property[]
Un array di Property oggetti che contiene i nomi delle proprietà e i valori da impostare per il report.
Valori restituiti
Un array di Warning oggetti che descrive eventuali avvisi avvenuti quando la definizione del report è stata validata.
Esempio
Per compilare questo esempio di codice, devi fare riferimento al WSDL di Reporting Services e importare determinati namespace. Per maggiori informazioni, vedi Compiling and Conducting Code Examples. Il seguente esempio di codice pubblica un report sotto forma di file di Linguaggio di Definizione di Report (RDL) su un database di server di report.
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());
}
}
}
Commenti
La tabella sottostante mostra informazioni sull'intestazione e sui permessi di questa operazione.
| Intestazioni SOAP | (Dentro) BatchHeaderValue (Fuori) ServerInfoHeaderValue |
| Autorizzazioni necessarie | Creare un nuovo report: CreateReport sulle Parent fonti dati del report E ReadPropertiesReadProperties sui dataset del reportAggiornamento di un report esistente: su E su (se Properties contiene proprietà) E UpdateProperties sulle fonti dati del report E UpdateProperties sui dataset del report ReportUpdatePropertiesReportUpdateReportDefinition |
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.
Se si verificano errori, il report non viene creato.
Aggiungere un report al database del server di report modifica le ModifiedBy proprietà e ModifiedDate della cartella genitore.