Export (0) Print
Expand All
Expand Minimize

BIMonitoringServiceApplicationProxy.CreateDataSource method

Saves a data source object as a content type in a SharePoint document library.

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

public DataSource CreateDataSource(
	string listUrl,
	DataSource dataSource
)

Parameters

listUrl
Type: System.String

The server-relative URL of the SharePoint document library to save the object to. Example: /BI Center/Data Connections for PerformancePoint.

dataSource
Type: Microsoft.PerformancePoint.Scorecards.DataSource

The data source object to create, which specifies values for the required Name property. For custom data sources, dataSource must also specify the SubTypeId property, and the value must match the subType attribute specified for the custom data source in the web.file for PerformancePoint Services.

Return value

Type: Microsoft.PerformancePoint.Scorecards.DataSource
The new data source.

Implements

IBIMonitoringServiceApplicationProxy.CreateDataSource(String, DataSource)

PerformancePoint Services uses SharePoint document libraries as the repository for data sources.

The following code example shows how to use a private method to create a data source and save it to the repository.

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 Start: Set up the development environment for SharePoint 2013.

  • Add the Microsoft.PerformancePoint.Scorecards.Client, Microsoft.PerformancePoint.Scorecards.ServerCommon, and Microsoft.SharePoint 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 directive to your class: 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);
}
Show:
© 2015 Microsoft