ReportingService2010.CreateCatalogItem Método
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Añade un nuevo elemento a una base de datos de servidor de informes o a una biblioteca de SharePoint. Este método se aplica a los Reporttipos de elementos, Model, Dataset, ComponentResource, , y DataSource elementos.
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
Parámetros
- ItemType
- String
Tipo de elemento.
- Name
- String
El nombre del nuevo elemento, incluyendo la extensión del archivo en modo SharePoint.
- Parent
- String
La URL totalmente calificada para la carpeta principal que contendrá el elemento.
- Overwrite
- Boolean
Una Boolean expresión que indique si debe ser sobrescrito un elemento existente que tenga el mismo nombre en la ubicación especificada.
- Definition
- Byte[]
La definición del informe .rdl, la definición del modelo de informe o el contenido de recursos para publicar en el servidor de informes.
- Properties
- Property[]
Un array de Property objetos que contiene los nombres de propiedades y valores a establecer para el elemento.
- Warnings
- Warning[]
[fuera] Un array de Warning objetos que describe cualquier advertencia que haya ocurrido cuando se validó el elemento.
Devoluciones
Un CatalogItem objeto para el objeto recién creado.
- Atributos
Ejemplos
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
Comentarios
La siguiente tabla muestra la información sobre cabeceras y permisos sobre esta operación.
| Uso de la cabecera SOAP | (En) TrustedUserHeaderValue (Fuera) ServerInfoHeaderValue |
| Permisos requeridos en modo nativo | Depende del tipo de objeto: - ReportCreación de un nuevo informe: CreateReport sobre Parent Y ReadProperties sobre las fuentes de datos del informe Y ReadProperties sobre los conjuntos de datos del informeActualización de un informe existente: UpdateReportDefinition en Item (si Properties contiene propiedades) Y UpdateProperties en Item Y UpdateProperties en las fuentes de datos del informe Y UpdateProperties en los conjuntos de datos del informe- DataSetCrear un nuevo conjunto de datos compartido: CreateReport en Parent Y ReadProperties en las fuentes de datos del conjunto de datosActualización de un conjunto de datos compartido existente: en Y en Item (si Properties contiene propiedades) Y UpdateProperties en las fuentes de datos del conjunto UpdateProperties de datos ItemUpdateReportDefinition- Resource, Component:Creando un nuevo artículo: CreateResource en ParentActualizar un elemento existente: UpdateContent en ItemActualizando propiedades de los objetos: UpdateContent Y UpdateProperties activado Item- DataSource:Creando una nueva fuente de datos: CreateDatasource en ParentActualizar una fuente de datos existente: UpdateContent Actualización de propiedades de la fuente de datos: UpdateContent Y UpdateProperties - Model: CreateModel |
| Permisos requeridos en el modo SharePoint | Depende del tipo de objeto: - ReportCreación de un nuevo informe: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> sobre Parent Y <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> sobre fuentes de datos y conjuntos de datos definidos en DefinitionActualizar un informe existente: <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems> en Item Y <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> sobre fuentes de datos y conjuntos de datos definidos en Definition Y <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> en Item (si Properties contiene propiedades)- DataSetCreación de un nuevo conjunto de datos compartido: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> en Parent Y <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> en fuentes de datos definidas en DefinitionActualizar un conjunto de datos compartido existente: <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems> en Item Y <xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems> en fuentes de datos definidas en<xref:Microsoft.SharePoint.SPBasePermissions.ViewListItems>Definitionen Item (si Properties contiene propiedades)- Resource, DataSource, Component:Creando un nuevo artículo: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> en ParentActualizar un elemento existente: <xref:Microsoft.SharePoint.SPBasePermissions.EditListItems> en Item- Model: <xref:Microsoft.SharePoint.SPBasePermissions.AddListItems> on Parent |
Este método puede crear elementos de todos los tipos de elementos soportados. Para ver qué tipos de elementos están soportados, utiliza el ListItemTypes método.
El Model tipo de elemento no puede ser sobrescribido. Por lo tanto, el Overwrite parámetro debe ser False si ItemType es Model. De lo contrario, se lanza una excepción rsInvalidParameterCombination .
Si ItemType es Report, entonces los datos XML están definidos por el Lenguaje de Definición de Informes. Si ItemType es Model, entonces los datos XML están definidos por el Lenguaje de Definición de Modelos Semánticos.
Si ocurren errores, el elemento no se crea.
Añadir un elemento a una base de datos de servidor de informes o a una biblioteca de SharePoint modifica las ModifiedBy propiedades y ModifiedDate de la carpeta padre.
Si la extensión de nombre de archivo aplicable (por ejemplo, .rdl) se excluye del nombre del elemento, se devolverá un rsFileExtensionRequired error.
La longitud del Parent parámetro no puede superar los 260 caracteres; de lo contrario, se lanza una excepción SOAP con el código de error rsItemLengthExceeded.
El Parent parámetro no puede ser nulo ni vacío ni contener los siguientes caracteres reservados: : ? ; @ & = + $ , \ * > < | . ". Puedes usar el carácter de barra hacia adelante (/) para separar elementos en el nombre completo de la carpeta, pero no puedes usarlo al final del nombre de la carpeta.