Compartir a través de


del método SPDataStore.CreateDataSource

Guarda un objeto de origen de datos como un tipo de contenido en una biblioteca de documentos de SharePoint.

Espacio de nombres:  Microsoft.PerformancePoint.Scorecards.Store
Ensamblado:  Microsoft.PerformancePoint.Scorecards.Store (en Microsoft.PerformancePoint.Scorecards.Store.dll)

Sintaxis

'Declaración
Public Function CreateDataSource ( _
    listUrl As String, _
    dataSource As DataSource _
) As DataSource
'Uso
Dim instance As SPDataStore
Dim listUrl As String
Dim dataSource As DataSource
Dim returnValue As DataSource

returnValue = instance.CreateDataSource(listUrl, _
    dataSource)
public DataSource CreateDataSource(
    string listUrl,
    DataSource dataSource
)

Parámetros

  • listUrl
    Tipo: System.String

    El servidor de dirección URL relativa de la biblioteca de documentos de SharePoint para guardar el origen de datos. Ejemplo: /BI Center/Data Connections for PerformancePoint.

  • dataSource
    Tipo: Microsoft.PerformancePoint.Scorecards.DataSource

    El objeto origen de datos para guardar, que especifica valores para la propiedad requerido Name . Para los orígenes de datos personalizados, dataSource también debe especificar la propiedad SubTypeId y el valor debe coincidir con el atributo subType especificado para el origen de datos personalizado en el web.file para PerformancePoint Services en SharePoint Server 2013.

Valor devuelto

Tipo: Microsoft.PerformancePoint.Scorecards.DataSource
El nuevo objeto que contiene información actualizada tal su ubicación y número de versión.

Implementaciones

IBIMonitoringStore.CreateDataSource(String, DataSource)

Comentarios

Para el desarrollo de PerformancePoint Services , utilice el método BIMonitoringServiceApplicationProxy.CreateDataSource(String, DataSource) en lugar de utilizar esta aplicación. Para obtener más información, consulte la sección "Interactuar con objetos del repositorio" en Editors for Custom Objects.

Ejemplos

En el ejemplo de código siguiente se muestra cómo utilizar un método privado para crear un origen de datos y llame a BIMonitoringServiceApplicationProxy.CreateDataSource(String, DataSource) para guardarlo en el repositorio.

Para poder compilar este ejemplo de código, debe hacer lo siguiente:

  • Configurar el entorno de desarrollo y crear un proyecto de biblioteca de clases de C# en Visual Studio. Para obtener información acerca de cómo configurar un entorno de desarrollo, consulte Configurar un entorno de desarrollo general para SharePoint 2013.

  • Agregue los archivos DLL de Microsoft.SharePoint, el Microsoft.PerformancePoint.Scorecards.ServerCommon y el Microsoft.PerformancePoint.Scorecards.Client como referencias al proyecto. Para obtener más información acerca de PerformancePoint Services de archivos DLL, consulte PerformancePoint Services DLLs Used in Development Scenarios.

  • Agregue la siguiente directiva de using a la clase: using Microsoft.PerformancePoint.Scorecards;.

// Create a data source that uses the Adventure Works sample cube, based on the following parameters:
//   - dataSourceName is the name for the data source.
//   - docLibUrl is the server-relative URL of the document library to save the data  
//         source to. Example: "/BI Center/Data Connections for PerformancePoint"
// This method returns the new data source. 
private DataSource CreateDataSource(string dataSourceName, string docLibUrl)
{
    if (String.IsNullOrEmpty(dataSourceName))
        throw new ArgumentException("The name must not be null or empty.");
    if (String.IsNullOrEmpty(docLibUrl))
        throw new ArgumentException("The document library URL must not be null or empty.");

    // Create an ADOMD.NET data source that represents the Adventure Works sample cube.
    DataSource ds = DataSource.CreateNew();
    ds.Name.Text = dataSourceName;
    ds.Description.Text = "Created with the SDK.";
    ds.ServerName = "MyServer";
    ds.DatabaseName = "Adventure Works DW";
    ds.CubeName = "Direct Sales";

    // The SourceName property must match the name of a data source provider registered in
    // the CustomDataSourceProviders section of the PerformancePoint Services web.config file.
    // The default path to the web.config file is 
    // %ProgramFiles%\Microsoft Office Servers\14.0\WebServices\PpsMonitoringServer.

    ds.SourceName = "ADOMD.NET";

    // Call the CreateDataSource method to save the new data source to the specified document library.
    // TODO: Handle exceptions from this call.
    // All interaction with the data source should go through the application server.
    // If this code is running within the application server, call the data store directly, as follows.
    // return SPDataStore.GlobalDataStore.CreateDataSource(docLibUrl, ds);

    // If this code is running on a front-end Web server, call the service application proxy, as follows.
    return BIMonitoringServiceApplicationProxy.Default.CreateDataSource(docLibUrl, ds);
}

Vea también

Referencia

clase SPDataStore

Miembros SPDataStore

Espacio de nombres Microsoft.PerformancePoint.Scorecards.Store

Otros recursos

How to: Create tabular data source editors for PerformancePoint Services

How to: Create tabular data source providers for PerformancePoint Services