ReportingService2010.CreateDataSource 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.
Crea una nuova fonte dati in un database server di report o in una raccolta di SharePoint.
public:
ReportService2010::CatalogItem ^ CreateDataSource(System::String ^ DataSource, System::String ^ Parent, bool Overwrite, ReportService2010::DataSourceDefinition ^ Definition, cli::array <ReportService2010::Property ^> ^ Properties);
[System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateDataSource", 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 CreateDataSource(string DataSource, string Parent, bool Overwrite, ReportService2010.DataSourceDefinition Definition, ReportService2010.Property[] Properties);
[<System.Web.Services.Protocols.SoapDocumentMethod("http://schemas.microsoft.com/sqlserver/reporting/2010/03/01/ReportServer/CreateDataSource", 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.CreateDataSource : string * string * bool * ReportService2010.DataSourceDefinition * ReportService2010.Property[] -> ReportService2010.CatalogItem
Public Function CreateDataSource (DataSource As String, Parent As String, Overwrite As Boolean, Definition As DataSourceDefinition, Properties As Property()) As CatalogItem
Parametri
- DataSource
- String
Il nome della sorgente dati include il nome del file e, in modalità SharePoint, l'estensione (.rsds).
- Parent
- String
L'URL completamente qualificato per la cartella genitore che conterrà la fonte dei dati.
- Overwrite
- Boolean
Un'espressione Boolean che indica se una sorgente di dati esistente con lo stesso nome nella posizione specificata deve essere sovrascritta.
- Definition
- DataSourceDefinition
Un oggetto che descrive le proprietà di DataSourceDefinition connessione per la sorgente dati.
- Properties
- Property[]
Un array di Property oggetti che definisce i nomi delle proprietà e i valori da impostare per la sorgente dati.
Valori restituiti
Un CatalogItem oggetto per la nuova fonte di dati creata.
- 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;
string name = "AdventureWorks.rsds";
string parent = "http://<Server Name>/Docs/Documents/";
// Define the data source definition.
DataSourceDefinition definition = new DataSourceDefinition();
definition.CredentialRetrieval =
CredentialRetrievalEnum.Integrated;
definition.ConnectString =
"data source=(local);initial catalog=AdventureWorks";
definition.Enabled = true;
definition.EnabledSpecified = true;
definition.Extension = "SQL";
definition.ImpersonateUserSpecified = false;
//Use the default prompt string.
definition.Prompt = null;
definition.WindowsCredentials = false;
try
{
rs.CreateDataSource(name, parent, false,
definition, null);
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.InnerXml.ToString());
}
}
}
Imports System
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 name As String = "AdventureWorks.rsds"
Dim parent As String = "http://<Server Name>/Docs/Documents/"
' Define the data source definition.
Dim definition As New DataSourceDefinition()
definition.CredentialRetrieval = _
CredentialRetrievalEnum.Integrated
definition.ConnectString = _
"data source=(local);initial catalog=AdventureWorks"
definition.Enabled = True
definition.EnabledSpecified = True
definition.Extension = "SQL"
definition.ImpersonateUserSpecified = False
'Use the default prompt string.
definition.Prompt = Nothing
definition.WindowsCredentials = False
Try
rs.CreateDataSource(name, parent, False, _
definition, Nothing)
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 | Creazione di una nuova fonte di dati: CreateDatasource su ParentAggiornamento di una fonte dati esistente: UpdateContent su DataSourceAggiornamento delle proprietà della sorgente dati: UpdateContent AND UpdateProperties on DataSource |
| Permessi richiesti in modalità SharePoint | Creazione di una nuova fonte di dati: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> su ParentAggiornamento di una fonte dati esistente: <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems> su DataSource |
Se l'estensione .rsds viene esclusa dal nome della sorgente dati, verrà restituito un rsFileExtensionRequired errore. Se viene fornita un'estensione .odc, viene restituito un rsNotSupported errore.
Se si verificano errori, la fonte dati non viene creata.
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.