SPDataStore.UpdateDataSource - Méthode

Met à jour une source de données 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 UpdateDataSource ( _
    dataSource As DataSource _
) As DataSource
'Utilisation
Dim instance As SPDataStore
Dim dataSource As DataSource
Dim returnValue As DataSource

returnValue = instance.UpdateDataSource(dataSource)
public DataSource UpdateDataSource(
    DataSource dataSource
)

Paramètres

Valeur renvoyée

Type : Microsoft.PerformancePoint.Scorecards.DataSource
L'objet mis à jour, qui contient des informations mises à jour, telles que le nouveau numéro de version.

Implémentations

IBIMonitoringStore.UpdateDataSource(DataSource)

Remarques

Pour le développement de PerformancePoint Services dans SharePoint Server 2013 , utilisez la méthode BIMonitoringServiceApplicationProxy.UpdateDataSource(DataSource) à la place. Pour plus d'informations, voir la section « Interagir avec des objets du référentiel » dans Editors for Custom Objects.

Pour dataSource, nous vous recommandons d'utiliser un objet de source de données qui a été précédemment extraite à l'aide de la méthode GetDataSource(RepositoryLocation) .

Exemples

L'exemple de code suivant montre comment récupérer et mettre à jour une source de données.

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 les DLL de Microsoft.PerformancePoint.Scorecards.ServerCommon et de 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 les directives using suivantes à votre classe.

    using Microsoft.PerformancePoint.Scorecards;
    using System.Globalization;
    
  • Créez une méthode qui effectue les opérations suivantes :

    • Définit une variable chaîne nommée « relativePath » pour stocker le chemin d'accès relatif de serveur à l'objet. Le chemin d'accès exemple suivant définit l'identificateur d'objet à « 5 »: /BI Center/Data Connections for PerformancePoint/5_.000.

    • Crée une instance d'un objet DataSource nommé « updatedDataSource ». Pour obtenir un exemple illustrant comment créer l'objet, voir la méthode CreateDataSource .

  • Collez le code suivant dans la nouvelle méthode.

// Create a RepositoryLocation object to represent the location of the data source. 
// The constructor takes the server-relative path to the data source.
RepositoryLocation dataSourceLocation = new RepositoryLocation(relativePath);

// As a best practice, retrieve an object and then update it.
// This example assumes the code is running in a Web Part on a front-end Web server.
// If this code is running within a service application, then you can call the
// SPDataStore.GlobalStore.GetDataSource method directly.
DataSource requestedDataSource =
    BIMonitoringServiceApplicationProxy.Default.GetDataSource(dataSourceLocation);

if (requestedDataSource != null)
{

    // Update the description to show the time of the last update operation.
    requestedDataSource.Description.Text = String.Format(
        CultureInfo.CurrentCulture,
        "Last updated at {0}",
        DateTime.Now.ToLocalTime());

    // Update the data source in the repository.
    updatedDataSource = 
        BIMonitoringServiceApplicationProxy.Default.UpdateDataSource(requestedDataSource);
}

Voir aussi

Référence

SPDataStore classe

SPDataStore - Membres

Microsoft.PerformancePoint.Scorecards.Store - Espace de noms