SPDataStore.UpdateDataSource method

Updates a data source in a SharePoint document library.

Namespace:  Microsoft.PerformancePoint.Scorecards.Store
Assembly:  Microsoft.PerformancePoint.Scorecards.Store (in Microsoft.PerformancePoint.Scorecards.Store.dll)

Syntax

'Declaration
Public Function UpdateDataSource ( _
    dataSource As DataSource _
) As DataSource
'Usage
Dim instance As SPDataStore
Dim dataSource As DataSource
Dim returnValue As DataSource

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

Parameters

Return value

Type: Microsoft.PerformancePoint.Scorecards.DataSource
The updated object, which contains updated information such as the new version number.

Implements

IBIMonitoringStore.UpdateDataSource(DataSource)

Remarks

For PerformancePoint Services in SharePoint Server 2013 development, use the BIMonitoringServiceApplicationProxy.UpdateDataSource(DataSource) method instead. For more information, see the "Interacting with Repository Objects" section in Editors for Custom Objects.

For dataSource, we recommend that you use a data source object that was previously retrieved by using the GetDataSource(RepositoryLocation) method.

Examples

The following code example shows how to retrieve and then update a data source.

Before you can compile this code example, you must do the following:

  • Configure your development environment and create a C# class library project in Visual Studio. For information about configuring a development environment, see Set up a general development environment for SharePoint 2013.

  • Add the Microsoft.PerformancePoint.Scorecards.Client and Microsoft.PerformancePoint.Scorecards.ServerCommon DLLs as references to your project. For more information about PerformancePoint Services DLLs, see PerformancePoint Services DLLs Used in Development Scenarios.

  • Add the following using directives to your class.

    using Microsoft.PerformancePoint.Scorecards;
    using System.Globalization;
    
  • Create a method that does the following:

    • Defines a string variable named "relativePath" to store the server-relative path to the object. The following example path sets the object identifier to "5": /BI Center/Data Connections for PerformancePoint/5_.000.

    • Creates an instance of a DataSource object named "updatedDataSource." For an example of how to create the object, see the CreateDataSource method.

  • Paste the following code example into the new method.

// 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);
}

See also

Reference

SPDataStore class

SPDataStore members

Microsoft.PerformancePoint.Scorecards.Store namespace