Share via


SPDataStore.CreateDataSource - Méthode

Enregistre un objet de source de données sous la forme d'un type de contenu dans une bibliothèque de documents SharePoint.

Espace de noms :  Microsoft.PerformancePoint.Scorecards.Store
Assembly :  Microsoft.PerformancePoint.Scorecards.Store (dans Microsoft.PerformancePoint.Scorecards.Store.dll)

Syntaxe

'Déclaration
Public Function CreateDataSource ( _
    listUrl As String, _
    dataSource As DataSource _
) As DataSource
'Utilisation
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
)

Paramètres

  • listUrl
    Type : System.String

    L'URL relative de serveur de la bibliothèque de documents SharePoint pour enregistrer la source de données. Exemple : /BI Center/Data Connections for PerformancePoint.

  • dataSource
    Type : Microsoft.PerformancePoint.Scorecards.DataSource

    L'objet source de données à enregistrer, qui spécifie les valeurs de la propriété requise Name . Pour les sources de données personnalisées, dataSource doit également spécifier la propriété SubTypeId , et la valeur doit correspondre à l'attribut subType spécifié pour la source de données personnalisées dans le web.file pour PerformancePoint Services dans SharePoint Server 2013.

Valeur renvoyée

Type : Microsoft.PerformancePoint.Scorecards.DataSource
Le nouvel objet, qui contient des informations mises à jour ce son numéro de version et d'emplacement.

Implémentations

IBIMonitoringStore.CreateDataSource(String, DataSource)

Remarques

Pour le développement de PerformancePoint Services , utilisez la méthode BIMonitoringServiceApplicationProxy.CreateDataSource(String, DataSource) au lieu d'utiliser cette implémentation. Pour plus d'informations, voir la section « Interagir avec des objets du référentiel » dans Editors for Custom Objects.

Exemples

L'exemple de code suivant montre comment utiliser une méthode privée pour créer une source de données et d'appeler BIMonitoringServiceApplicationProxy.CreateDataSource(String, DataSource) pour l'enregistrer dans le référentiel.

Pour pouvoir compiler cet exemple de code, vous procédez comme suit :

  • Configurer votre environnement de développement et créer un projet de bibliothèque de classes c# dans Visual Studio. Pour plus d'informations sur la configuration d'un environnement de développement, voir Configurer un environnement de développement général pour SharePoint 2013.

  • Ajoutez la DLL de Microsoft.SharePoint, Microsoft.PerformancePoint.Scorecards.ServerCommon et Microsoft.PerformancePoint.Scorecards.Client en tant que références à votre projet. Pour plus d'informations sur PerformancePoint Services DLL, voir PerformancePoint Services DLLs Used in Development Scenarios.

  • Ajoutez la directive using suivante à votre classe : 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);
}

Voir aussi

Référence

SPDataStore classe

SPDataStore - Membres

Microsoft.PerformancePoint.Scorecards.Store - Espace de noms

Autres ressources

How to: Create tabular data source editors for PerformancePoint Services

How to: Create tabular data source providers for PerformancePoint Services