다음을 통해 공유


SPDataStore.CreateDataSource Method

Saves a data source object as a content type 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 CreateDataSource ( _
    listUrl As String, _
    dataSource As DataSource _
) As DataSource
'Usage
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
)

Parameters

  • listUrl
    Type: System.String

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

  • dataSource
    Type: Microsoft.PerformancePoint.Scorecards.DataSource

    The data source object to save, 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 in Microsoft SharePoint Server 2010.

Return Value

Type: Microsoft.PerformancePoint.Scorecards.DataSource
The new object, which contains updated information such its location and version number.

Implements

IBIMonitoringStore.CreateDataSource(String, DataSource)

Remarks

For PerformancePoint Services in Microsoft SharePoint Server 2010 development, use the BIMonitoringServiceApplicationProxy.CreateDataSource(String, DataSource) method instead of using this implementation. For more information, see the "Interacting with Repository Objects" section in Editors for Custom PerformancePoint Services Objects.

Examples

The following code example shows how to use a private method to create a data source and call BIMonitoringServiceApplicationProxy.CreateDataSource(String, DataSource) to save it to the repository.

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

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

See Also

Reference

SPDataStore Class

SPDataStore Members

Microsoft.PerformancePoint.Scorecards.Store Namespace

Other Resources

Create Tabular Data Source Extensions for PerformancePoint Services